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: Mon, 18 Dec 2006 20:54:07 +0100
Message-ID: <4ef2fbf50612181154g7d47b6f0lca0e5f4f3c89580d@mail.gmail.com>


should be

variable r refcursor

DECLARE
   P_INTERVAL NUMBER;
BEGIN
   P_INTERVAL := 885653507;
   Proce ( P_INTERVAL, :r );
   COMMIT;
END;
/

print r

Key: the pl/sql block is executed by the server, the server sets the :r output bind variables, which maps to the r variable inside sqlplus - then sqlplus prints it.

On 12/18/06, Harvinder Singh <Harvinder.Singh_at_metratech.com> wrote:
> I tried these options but getting error:
> DECLARE
> P_INTERVAL NUMBER;
> v_cursor refcursor;
> BEGIN
> P_INTERVAL := 885653507;
> Proce ( P_INTERVAL, :v_cursor );
> print :v_cursor;
> COMMIT;
> END;
> /
>
> SP2-0552: Bind variable "V_CURSOR" not declared
>
> -----Original Message-----
> From: rjamya [mailto:rjamya_at_gmail.com]
> Sent: Monday, December 18, 2006 11:13 AM
> To: Harvinder Singh
> Cc: oracle-l
> Subject: Re: How to execute procedure returning refcursor from sqlplus
>
> var myref refcursor
> exec my_proc(:myref,param1,param2,...);
> print :myref
>
>
> Raj
>
> On 12/18/06, Harvinder Singh <Harvinder.Singh_at_metratech.com> wrote:
> > Hi,
> >
> > We have a procedure that returns the sys_refcursor as an ouput and
> that is
> > select statement with 2 columns, now I have to execute that procedure
> from
> > sqlplus/toad and display the results, How can I declare a local
> varaiables
> > and execute the procedure and return thre result using dbms_output?
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

-- 
Alberto Dell'Era
"Per aspera ad astra"
--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 18 2006 - 13:54:07 CST

Original text of this message

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