OS variables to sqlplus

posted Sep 10, 2010, 7:05 AM by Sachchida Ojha
One can pass operating system variables to sqlplus using this syntax:

sqlplus username/password @cmdfile.sql var1 var2 var3

Parameter var1 will be mapped to SQL*Plus variable &1, var2 to &2, etc. Look at this example:

sqlplus scott/tiger @x.sql  '"test parameter"' dual
Where x.sql consists of:
select '&1' from &2;
exit 5;