Re: Passing String Arguments to SQL*Plus from a Unix Shell
- From: "Radoulov, Dimitre" <cichomitiko@xxxxxxxxx>
- To: <oracle-l@xxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 13:41:12 +0200
[...]
I need to pass arguments containing the SQL string delimiter "'" to
sqlplus from a shell script, e.g.:
sqlplus user/pass @my.sql $1
where $1 should be like "'1','2','3'", so that a SQL statement WHERE
clause within the script can be modified like this:
define inlist=&1
...
SELECT something FROM mytable
WHERE something NOT IN ( &inlist );
-->
WHERE mycol NOT IN ( '1','2','3' );
[...]
$ cat my.sql
set echo on
define inlist=&1
SELECT null FROM dual
WHERE dummy NOT IN ( &inlist );
exit
$ cat run.sh
sqlplus -s / as sysdba @my.sql<<!
"$1"
!
$ ./run.sh "'1','2','3'"
Enter value for 1: old 2: WHERE dummy NOT IN ( &inlist )
new 2: WHERE dummy NOT IN ( '1','2','3' )
N
-
Dimitre
--
http://www.freelists.org/webpage/oracle-l
- References:
- Passing String Arguments to SQL*Plus from a Unix Shell
- From: Uwe Küchler
Other related posts:
- » Passing String Arguments to SQL*Plus from a Unix Shell
- » Re: Passing String Arguments to SQL*Plus from a Unix Shell
- » RE: Passing String Arguments to SQL*Plus from a Unix Shell
- » Re: Passing String Arguments to SQL*Plus from a Unix Shell
- » Re: Passing String Arguments to SQL*Plus from a Unix Shell
- » Re: Passing String Arguments to SQL*Plus from a Unix Shell
- » Re: Passing String Arguments to SQL*Plus from a Unix Shell
I need to pass arguments containing the SQL string delimiter "'" to sqlplus from a shell script, e.g.: sqlplus user/pass @my.sql $1 where $1 should be like "'1','2','3'", so that a SQL statement WHERE clause within the script can be modified like this: define inlist=&1 ... SELECT something FROM mytable WHERE something NOT IN ( &inlist ); --> WHERE mycol NOT IN ( '1','2','3' );
- Passing String Arguments to SQL*Plus from a Unix Shell
- From: Uwe Küchler