Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> ksh unix variable on cmd line
Solaris 9
Oracle 10.1.0.3
I see a reference (actually on lazydba) to supplying an environment
variable on the sqlplus command line and referencing it within
sqlplus. Here's that example:
Sqlplus username/pwd $unix_variable_name <<END
Create or replace directory <directory_name> as '&1';
Exit;
End
This sure doesn't work for me.
Does anyone see what I'm doing wrong?
Thanks for any help.
$ more test.sh
#!/bin/ksh
. /oracle/set_environ.sh
export SDAT=SYSDATE
echo $SDAT
sqlplus user/pwd $SDAT << EOF
select '&1' from dual;
exit
EOF
exit
./test.sh
Current oracle_home is /oracle/app/oracle/product/10g
SYSDATE
Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
where <option> ::= -H | -V | [ [-C <v>] [-L] [-M <o>] [-R <n>] [-S] ]
<logon> ::= <username>[/<password>][@<connect_identifier>] | / | /NOLOG
<start> ::= @<URL>|<filename>[.<ext>] [<parameter> ...]
"-H" displays the SQL*Plus version banner and usage syntax . . . . .
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Aug 05 2005 - 10:46:46 CDT
![]() |
![]() |