Re: urgent help needed!! - connecting to db through unix script

From: John P. Higgins <jh33378nospam_at_deere.com>
Date: 1998/03/16
Message-ID: <350D6349.74D4_at_deere.com>#1/1


Try this (ksh):

sqlplus <<EOF
scott/tiger
spool env.sh
select 'export ENV1=' || table.value from table where .... exit
EOF
. env.sh
print $ENV1

Or this (csh):
sqlplus <<EOF
scott/tiger
spool env.sh
select 'setenv ENV1 '|| table.value from table where .... exit
EOF
source env.sh
echo $ENV1
WayneB wrote:
>
> Hi all,
>
> This is someting I need to solve as soon as possible.
>
> From unix shell script I need to
>
> 1. Connect to a database
> 2. Retrieve values from a table
> 3. For each value, assign to an environment variable.
> 4. Close connection
>
> When the scripts finishes, I need to be able to see the environment
> variables
> by doing 'set' or 'env' (doesn't matter which one just so long as I can see
> the values
> from the command prompt).
>
> Thanks in advance.
> Wayne Leone
  Received on Mon Mar 16 1998 - 00:00:00 CET

Original text of this message