Example script for getting sqlplus query results into environment variables using awk and ksh
(I only use bash or ksh so don't even know how to set a variable in csh).
Replace USER with the actual username, PASS with user's password and DB with the tnsname for
database you're connecting to. This works when the sql queries (below) return a single record
each.
sqlplus -s USER/PASS@DB <<EOF | awk '{if(NR==1) printf("%s ", $1); if(NR==2) printf("%s ",
$1);}' | read VAR1 VAR2
set head off pagesize 0 echo off verify off feedback off
select name from v$database
/
select log_mode from v$database
/
EOF
|