Re: UNIX Environment Variables in SQL*Plus
Date: 4 Apr 1994 23:28:22 GMT
Message-ID: <2nq7qm$rfd_at_marlin.ssnet.com>
In article <12a.426.905.0N3E0AD2_at_compudata.com>, barry.roomberg_at_compudata.com (Barry Roomberg) writes:
|> -> How does one reference UNIX Environment Variables (for example $ABC)
|> -> in an
|>
|> One does not. SQLPLUS is a totall isolated environment, and
|> does not believe in the outside world.
|>
|> On the other hand, YOU could write something that would
|> dump your environment into a series of assign statements,
|> that could then be read from the login.sgl file.
In strict terms of sqlplus having a function or facility to read the environment under UNIX this is a true statment. However, one can reference environment variables in sqlplus with the following additional method:
sqlplus -s <<! > fooboar.out 2>&1
set head off;
select c1, c2, c3
from dept
where employee = $empsel;
exit;
!
The shell will evaluate the variable $empsel since your program is being passed to sqlplus via a standard input here document :) I have found this very usefull as an effective method of ramming parameters into sqlplus scripts that are embedded in shell scripts. Its once and done with no spills or cleanup :)
-- Thanks, -------------------------------------------------- joseph r minnich jminnich_at_bugaboo.ssnet.comReceived on Tue Apr 05 1994 - 01:28:22 CEST