Re: Referencing Unix vars with SqlPlus

From: Paul Zola <pzola_at_us.oracle.com>
Date: 1996/08/09
Message-ID: <4ufnmm$fn4_at_inet-nntp-gw-1.us.oracle.com>#1/1


In <4tagov$o6i_at_nyx10.cs.du.edu> djensen_at_nyx10.cs.du.edu (Dave Jensen) writes:

} Does anybody know of a way to reference Unix variables from within SqlPlus?
} I'd like to do this without having to pass them as parameters to the script.

Here's an example, using the host() command. Season to taste.

############################# cut here ###########################
#!/bin/sh

UNIXVAR=foobar
export UNIXVAR

TMP=/usr/tmp/t$$.sql
export TMP
trap 'rm -f $TMP' 0

sqlplus -s scott/tiger << EOF

    host echo "select '$UNIXVAR' as old_unixvar from dual;" > $TMP     column old_unixvar new_value unixvar

    set verify off
    set termout off
    start $TMP
    set termout on

    select '&unixvar' from dual;
    exit
EOF



Paul Zola Technical Specialist World-Wide Technical Support

GCS H--- s:++ g++ au+ !a w+ v++ C+++ UAV++$ UUOC+++$ UHS++++$ P+>++ E-- N++ n+

    W+(++)$ M+ V- po- Y+ !5 !j R- G? !tv b++(+++) !D B-- e++ u** h f-->+ r*


Disclaimer: 	Opinions and statements are mine, and do not necessarily
		reflect the opinions of Oracle Corporation.
Received on Fri Aug 09 1996 - 00:00:00 CEST

Original text of this message