Yes, Andy is right we should use bind variables in this case. try this. Create or replace Procedure Test_RefCurosr(Pemp_Id number,Pout IN OUT sys_refcursor) as V_Query Varchar2(2000); Begin V_Query :='select * from emp where EMPNO=:x'; Open Pout for V_Query using Pemp_Id;
End; / On Jan 15, 2:05 pm, Toxic <amarti...@gmail.com> wrote: > Spot on, that's the way I do it although I would use bind variables > which enable execution plans to be reused, thus increasing > performance. All depends upon your scenario of course. > Seehttp://www.akadia.com/services/ora_bind_variables.html > > Andy > > On Jan 14, 10:08 am, somy <somes...@gmail.com> wrote: > > > you may try this( works with scott schema) > > > Create or replace Procedure Test_RefCurosr(Pemp_Id number,Pout IN OUT > > sys_refcursor) > > as > > V_query varchar2(2000); > > Begin > > V_query:='select * from emp where EMPNO='||Pemp_ID; > > > Open Pout for > > V_query; > > > End; > > / > > > Variable x refcursor; > > exec Test_RefCurosr(7369,:x); > > Print X; > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---