ksh unix variable on cmd line

  • From: Barbara Baker <barb.baker@xxxxxxxxx>
  • To: Oracle-L@xxxxxxxxxxxxx
  • Date: Fri, 5 Aug 2005 09:44:43 -0600

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
  . . . . .
--
//www.freelists.org/webpage/oracle-l

Other related posts: