How to call stored procedure in SQL*PLUS?(s23)


I have written a stored procedure in Oracle. [proc(abc in out varchar2)]
The stored procedure will take the same parameter as in and out. However, how
can i call the procedure in SQL*PLUS.
I know that it should call below line

var in_para char(100)
execute proc(:in_para)

But, how can i assign the value '123' to the in_para??? Just
in_para:='123'???? Not work!!



Ans:

var in_para char(100)
exec :in_para :='123'
exec proc(:in_para)
print :in_para

for example:

  1  create or replace procedure proc( x in out char )
  2  as
  3  begin
  4     x := '456';
  5* end;
SQL> /

Procedure created.
 

SQL> var in_para char(100)
SQL> exec :in_para :='123'

PL/SQL procedure successfully completed.

SQL> exec proc(:in_para)

PL/SQL procedure successfully completed.

SQL> print :in_para

IN_PARA
---------
456
 

beware of CHAR unless you understand the blank padded comparision semantics...
 
 

Hosted by www.Geocities.ws

1