July 13th, 2004, 07:47 AM
Using Operating System Environment Variables in SQLPLUS
I'm looking for a way to use the Operating System Environment Variables inside of a sql script. I'd like to create a generic script that will run on all machines regardless of directory structure. I know that in SQLPLUS I can call on Operating System commands using ! followed by the Operating System command. But I'd like to use a SQL command using a Operating System variable. Example:
startup nomount pfile="$ORACLE_BASE/admin/orc3/pfile/init.ora";
July 13th, 2004, 11:17 AM
You really can't. Here's how to do it in Unix with ksh:
The $BANNER_HOME and $ORACLE_HOME are environment variables defined for all users....
UID = user
You can do something like this in perl, but again the same script will not work on any platform without serious coding effort.
UPUID=$(echo $UID | tr "[:lower:]" "[:upper:]")
export SQLDIR CTLLOC SORTDIR OUTDIR
set pages 0
WHERE gjbjobs_name = 'UZPGLTT'; " |
$ORACLE_HOME/bin/sqlplus -s )