RE: Escaping single quotes

RE: Escaping single quotes

 

  

Use chr(39) instead of "'"

You can try the below query to generate the sqls

Select 'alter session kill session
'||chr(39)||sid||','||serial#||chr(39)|| ';' from v$session
where username = 'COLUMBUSUN'
AND status='INACTIVE';

All the best.

Karthik

-----Original Message-----
From: Niki Tragen
[mailto:oracledba-ezmlmshield-x28206934.[Email address protected]
Sent: Thursday, September 30, 2004 6:27 PM
To: LazyDBA Discussion
Subject: Escaping single quotes

Hi

New to sql and trying to kill some connections. When I use the following
sql I can't seem
to get the single quotes in around the sid and serial# without syntax
errors

spool killcolumbus.sql
select
'alter system kill session ' || "'"|| sid|| ',' ||serial#||';'
from v$session
where username = 'COLUMBUSUN'
AND status='INACTIVE';
spool off

tried concatenating and trying to escape the ' as a special character
with \ but no
luck.

Can anyone help?

cheers
Niki



--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html


Oracle LazyDBA home page