Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to execute procedure returning refcursor from sqlplus
On 12/19/06, Ajay <ajay_1ajay_at_yahoo.com> 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_at_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_at_ORACLE10> variable r refcursor
dellera_at_ORACLE10> begin p (:r); end;
2 /
PL/SQL procedure successfully completed.
dellera_at_ORACLE10> print r
SALUTATIO
-- Alberto Dell'Era "Per aspera ad astra" -- http://www.freelists.org/webpage/oracle-lReceived on Tue Dec 19 2006 - 16:35:14 CST