RE: Escaping single quotes

RE: Escaping single quotes

 

  

select 'alter system kill session '''||s.sid||','||s.serial#||''''
from v$session s join v$process p on (s.PADDR=p.ADDR)

is what you want


Regards

John Fak
Oracle DBA
_____________________
Accenture Workforce Solutions

mobile: +44 (0)778 655 1214
landline: +44 (0)207 844 6981
Octel : (46981)
mailto:john.[Email address protected]



-----Original Message-----
From: KARTHIKEYAN Devarasu
[mailto:oracledba-ezmlmshield-x97574809.[Email address protected]
Sent: 30 September 2004 14:08
To: LazyDBA Discussion
Subject: 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



--------
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



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

Oracle LazyDBA home page