Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dynamically giving order by

user458361Jan 8 2007 — edited Jan 9 2007
hi
i want to write a procedure that accepts a parameter for setting up the order by and return the result in a cursor.. i wrote the procedure as follows .

CREATE OR REPLACE Procedure Proc_ord
(cur out sys_refcursor,ord number)
as

begin
open cur for
select company_id,company_name from company order by ord;

end ;
/



SQL> variable a refcursor;
SQL> exec P(:a,1);

PL/SQL procedure successfully completed.


though this retrieves data its not giving the correct order by ..what could be wrong with this? plz let me know what change i have to do....

regards
Faisal S
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2007
Added on Jan 8 2007
9 comments
656 views