Resorting a cursor
I have a PLSQL package that uses a cursor based on a complicated query. I want to reuse the same query for another report based on exactly the same data but sorted in a diffrent order. I have been told to aviod creating a view.
The code I have follows the following pattern:
function fn_name() return number
IS
CURSOR ELE_C
IS
Select * from per_all_assignments_f order by assignment_number;
BEGIN;
FOR ele_rec IN ele_C
LOOP
--Do stuff
END LOOP; return 0; ENDMy question is once you have defined a cursor in this way how can you loop through the records in a diffrent order?