Home » Other » Client Tools » passing variables into sqlplus
passing variables into sqlplus [message #13400] Mon, 12 July 2004 05:06 Go to next message
Manfred Himmler
Messages: 6
Registered: July 2002
Junior Member
In a UNIX Shell-Script I determine several variables out of a file, start sqlplus and then I will do sometime similiar like the following:

export REPORT=report01
export CUSTOMER=4711

Then after connecting to sqlplus in silent-mode I do START $REPORT $CUSTOMER. The variable $REPORT is correctly interpreted as report01.sql but not $CUSTOMER. In report01.sql I do a simple SELECT &1 FROM DUAL (for testing). When running I get the error
old 1: select &1 from dual
new 1: select $CUSTOMER from dual
ORA-00911: invalid character ($ from $CUSTOMER)

How can I pass a second variable (or third and so on) out of my UNIX-Environment into my start-command?

Thanks,
Manfred
Re: passing variables into sqlplus [message #13503 is a reply to message #13400] Thu, 15 July 2004 02:12 Go to previous message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Hi,

Try to pass the variables as arguments to sqlplus:

sqlplus -s scott/tiger @$REPORT $CUSTOMER

Best regards.

Frank
Previous Topic: WHAT IS TOAD
Next Topic: Trouble with sqlplus command in batch file
Goto Forum:
  


Current Time: Thu Mar 28 14:23:44 CDT 2024