SQL Language (MOSC)

MOSC Banner

Resorting a cursor

edited Feb 18, 2010 4:01AM in SQL Language (MOSC) 3 comments
 Hi,

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; END

My question is once you have defined a cursor in this way how can you loop through the records in a diffrent order?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center