Re: Pass values from sql to unix variable

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 10 Oct 2001 19:36:03 +0200
Message-ID: <ts91t4jfibspb1_at_news.demon.nl>


"Gloria Zhao" <gloriaz_ca_at_yahoo.com> wrote in message news:fcb331b6.0110100916.56c41a20_at_posting.google.com...
> Hi there,
>
> Could someone let me know if there is a way to pass a value from
> sqlplus session to a unix variable, I would appreciate it.
>
> Thanks,
>
> Gloria

sqlplus can be used in a pipe

if you start it in silent mode at set your heading off and feedback off there is no reason why you can't
var=`sqlplus -s <username/password>_at_servicename @yourscript`

where yourscript simply doesn't have to use a spool command Of course you could also make the best of both worlds and invoke sed and/or awk

var=`sqlplus -s <username/password>_at_servicename @yourscript | sed -e ...`

This all was invented to reduce the need for 'temporary' files as in the other answer.

Hth,

Sybrand Bakker
Senior Oracle DBA Received on Wed Oct 10 2001 - 19:36:03 CEST

Original text of this message