RE: Passing String Arguments to SQL*Plus from a Unix Shell

  • From: "David Moss" <David.Moss@xxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 29 Mar 2007 12:09:01 +0100

try
-----
$ echo "'1','2','3'"
'1','2','3'

$ echo "\"'1','2','3'\""
"'1','2','3'"
-----
maybe?

Dave.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx on behalf of Uwe Küchler
Sent: Thu 29/03/2007 11:06
To: oracle-l@xxxxxxxxxxxxx
Subject: Passing String Arguments to SQL*Plus from a Unix Shell
 
Hi all,

I've scanned this list and other forums but haven't found a satisfying
answer so far:
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' );

I know how to pass arguments/parameters without the "'", but when I use
"'" it gets erased by the shell. I've tried to escape the "'" but with no
success so far.
It looks so simple but I can't find a solution. *help*

Regards,
--==/ Uwe \==--

--
//www.freelists.org/webpage/oracle-l



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



This message is from FDM Group Plc, and may contain information that is 
confidential or privileged.  If you are not the intended recipient, please 
delete the message and any attachments and notify the sender.  This email is 
not intended to create legally binding commitments on behalf of FDM Group Plc, 
nor do its contents reflect the corporate views or policies of FDM.  Any 
unauthorised disclosure, use or dissemination, either whole or partial, is 
prohibited. FDM Group Plc is a private limited company registered in England 
(Reg. No. 2542980).


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Other related posts: