Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Pass a query into a stored proc?
Hi,
I want to be able to pass a select query into a procedure, open a cursor for that query then return the cursor.
So far, I have managed to make a function that opens a cursor for a hardcoded query, but is it possible to pass in a varchar2 which holds the query to execute? How's it done?
Here's the simple proc I have at the moment:
create or replace package types
as
type cursorType is ref cursor;
end;
/
create or replace procedure retcurs_proc
(mycurs out types.cursorType)
is
begin
open mycurs for select * from emp;
end retcurs_proc;
/
How could I change the above proc to be able to pass in a query?
thanks,