Re: Returning a value to UNIX shell

From: Jonathan Lewis <Jonathan_at_jlcomp.demon.co.uk>
Date: 1995/11/04
Message-ID: <815506513snz_at_jlcomp.demon.co.uk>#1/1


In article <47fbc2$imb_at_inet-nntp-gw-1.us.oracle.com>

           rmanalac_at_oracle.com "Roderick Manalac" writes:

: Extended further
: SQL> variable x number;
: SQL> column foo new_value _foo
: SQL> begin
: 2 :x := 5;
: 3 end;
: 4 /
:
: PL/SQL procedure successfully completed.
:
: SQL> select :x foo from dual;
:
: FOO
: ----------
: 5
:
: SQL> exit _foo;
: Disconnected from Oracle7 Server Release 7.1.6.2.0 - Production Release
: With the distributed, replication and parallel query options
: PL/SQL Release 2.1.6.2.0 - Production
: enrique% echo $status
: 5
:

Just to finish it off:


!/bin/ksh

         (this is supposed to be the 'hash' character

m_ReturnValue=`sqlplus -s / _at_my_script` echo $m_ReturnValue


where my_script.sql starts with:

set pagesize 0
set verify off
  etc....

select :x foo from dual;
exit


This mechasnism will even allow for returning an array of values to the Korn Shell. The important point is to prepare an SQL script that would otherwise spool precisely the output you would want to see.

-- 
Jonathan Lewis
Received on Sat Nov 04 1995 - 00:00:00 CET

Original text of this message