Re: Unix Env. Variables from PL/SQL
Date: 1997/05/21
Message-ID: <3382F040.521A_at_an.hp.com>#1/1
Richard Bolz wrote:
>
> Could someone tell me how I might access Unix environment variables from
> PL/SQL.
>
> Failing that, is there a good way (from PL/SQL or SQL PLUS) to move a
> file from one Unix directory to another?
>
> Thanx
>
> Dick
Dick
Here is an example of how I access a shell variable from PL/SQL. I pass
in
an argument (shell variable) on the command line itself.
sqlplus $USER/$PASS _at_$SQL_DIR/setcharges.sql $BATCH_ID >>
$LOG_DIR/$LOGFILE
Notice the $BATCH_ID, its a ksh variable. In the sql code, I then
reassign it to
a local variable this way:
DECLARE batch_id varchar2(6) := &&1;
This tells the internal variable to pick up the first command line
argument from above.
Then I use it from there on out.
Hope this helps
Keith Vargas
Hewlett Packard, Andover MA
Received on Wed May 21 1997 - 00:00:00 CEST