Re: How to execute procedure returning refcursor from sqlplus

On 12/19/06, Ajay <ajay_1ajay@xxxxxxxxx> wrote:
If you are talking about ref cursor : You need to do it from a pl/sql block
define variable for cursor and for record to same as in the SP.
then have loop and fetch the cursor to record. exit loop when cursor
not found.

Not necessarily:

dellera@ORACLE10> create or replace procedure p (p_out out sys_refcursor)
 2  is
 3  begin
 4    open p_out for select 'bye' as salutation from dual;
 5  end;
 6  /

Procedure created.

dellera@ORACLE10> variable r refcursor
dellera@ORACLE10> begin p (:r); end;
 2  /

PL/SQL procedure successfully completed.

dellera@ORACLE10> print r

SALUTATIO
---------
bye

--
Alberto Dell'Era
"Per aspera ad astra"
--
http://www.freelists.org/webpage/oracle-l


Other related posts: