Re: How to get output value of stored procedure in sql plus

From: Michael Cretan <mcretan_at_ozemail.com.au>
Date: Tue, 25 Jan 2000 20:18:20 +1100
Message-ID: <yRdj4.10238$3b6.48461_at_ozemail.com.au>


Calvin Ni <haitao_at_yesic.com> wrote in message news:388D1B0C.E71854BB_at_yesic.com...
> Hi,guys,
> How can I get the output values of a stored procedure in sql plus?
> I created a procedure sp1(a in char,b out char) and revoke it in sql
> plus as follows:
> execute sp1('11',c)
> How can I get the value of c?
> I did as this:
> declare c char(8)
> execute sp1('11',c);
> select c from dual;
> But I always got error message: should use 'into' in select ......
> Do you have some idea about that?
> Thanks!
>

Calvin,

use a SQL*PLUS bind variable as follows -

Create the bind variable using the SQL*Plus 'Variable' command SQL> variable c varchar2(255)

You can then reference it using a preceding colon (:) SQL> execute spq('11',:c)

If you want to examine the value you can use the print command SQL> print c

Or you could use it in a select statement ... SQL> select :c from dual;

See the SQL*Plus documentation on bind variables

Cheers,

Mike Received on Tue Jan 25 2000 - 10:18:20 CET

Original text of this message