Re: PL/SQL: Operating system variables???

From: Narayanan Olagappan <narayan_at_sprynet.com>
Date: 1997/08/26
Message-ID: <3403C94F.54FE_at_sprynet.com>#1/1


Michael A. Casillas wrote:
> I know how to pass variables INTO PL/SQL using the &1, &2 arguments, but
> how would I pass variables from PL/SQL OUT to the script??
>
> Michael

You can use dbms_output.put_line(...) in pl/sql and shell command 'read' in shell script.

For example:

sqlplus -s <uid>/<pwd> <<! | tail -1l | read line set feedback off
set serverout on
begin
dbms_output.put_line('Output from pl/sql'); end;
/
!
echo $line

will echo: Output from pl/sql

You can extent this mechanism to get the value from a out variable of a procedure.

declare

   out_value varchar(20);
begin

   <pl/sql procedure name>(out_value);
   dbms_output.put_line(out_value);
end; Received on Tue Aug 26 1997 - 00:00:00 CEST

Original text of this message