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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Procedure - how get the output value in sql+

Re: Procedure - how get the output value in sql+

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: 2000/04/18
Message-ID: <3908b6e6.30406732@netnews.worldnet.att.net>#1/1

You need to declare a SQL*Plus bind variable:

SQL>VARIABLE my_newid NUMBER;

Then invoke your function, and pass in that bind variable:

SQL>EXECUTE p_newid(1, :my_newid);

Note the colon used to mark the bind variable. You need to include that. Assuming this executes successfully, you can print the value of your bind variable, or you can use it in other statements:

SQL>PRINT my_newid

SQL>SELECT my_newid from DUAL;

EXECUTE p_newid(:my_newid, :my_newer_id);

Hope this helps.

Jonathan



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are

On Tue, 18 Apr 2000 16:07:20 GMT, newdb_at_my-deja.com wrote:

>I am new to Oracle and its PL/SQL.
>How can I get the output value of a procedure in sqlplus?
>Example:
> create or replace procedure p_newid (oldid IN number, newid out
>number ) is
> wn number;
>begin
> select ..... into wn;
> newid := wn;
>end;
>/
>
>When executing in sql+
> exec p_newid(1); I get
>
>ERROR at line 1:
>ORA-06550: line 1, column 7:
>PLS-00306: wrong number or types of arguments in call to
>'P_NEWID'
>ORA-06550: line 1, column 7:
>PL/SQL: Statement ignored
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Tue Apr 18 2000 - 00:00:00 CDT

Original text of this message

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