14-7. Creating a Sortable Web Report

Problem

You need a report that displays data that is sorted by a field the user selects.

Solution

Create a package that prompts the user for a sort field, then generates the sorted output using the sort field parameter in the ORDER BY section of the SELECT statement. In this example the user is prompted to select a sort option on the EMPLOYEEs table. The options are to sort by last name, hire date, salary, or employee ID.

Image Note See Recipe 14-1 to define a DAD and direct your browser to run your procedure.

Note See Recipe 14-2 for more information on the common package, which is used in this recipe.

CREATE ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.