Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling PL/SQL from Unix Shell

Status
Not open for further replies.

ajayarora

Programmer
Jun 5, 2003
24
CA
Hi,

I'm calling a PL/SQL procedure from a unix shell script. Shell gets its params from a file and passes them (enclosing the params in single quotes) to PL/SQL.It works fine for most of the cases but whenever a parameter contains single quote(') in it, procedure fails with the error message :
'quoted string not properly terminated'

Can anyone suggest anything to overcome this problem.

Regards
Ajay.
 
put the plsql script into a file and @<file> at the sqlplus prompt, or on the sqlplus command-line
 
If jad's sugesstion doesn't work for you, try sending every argument through sed before passing it to SQLPlus, placing a backslash before any embedded single-quotes, as in:

my_argument=`echo $my_argument | sed &quot;s/'/\\'/g&quot;`

This way, the SQLPlus command will pass the variables intact.
 
Hi Sampsonr,

I'm sending two single quotes using sed like

my_argument=`echo $my_argument | sed &quot;s/'/\'\'/g&quot;`

Its working fine now. Thanks for your suggestion and time.

Regards
Ajay.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top