Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to execute procedure returning refcursor from sqlplus

Re: How to execute procedure returning refcursor from sqlplus

From: Alberto Dell'Era <alberto.dellera_at_gmail.com>
Date: Tue, 19 Dec 2006 23:35:14 +0100
Message-ID: <4ef2fbf50612191435p5efee205qd6441eeec2e206c4@mail.gmail.com>


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



bye
-- 
Alberto Dell'Era
"Per aspera ad astra"
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Dec 19 2006 - 16:35:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US