Re: Newbie Question - Concatenating quotes

From: Gary Kirsh <gkirsh_at_dorsai.org>
Date: Mon, 9 Jan 1995 15:49:13 GMT
Message-ID: <D25AM1.Lqp_at_dorsai.org>


Sue Kudenchak (sarroyo_at_cnj.digex.net) wrote:
: Good morning:
 

: I have another newbie question.
 

: I want to dynamically create "alter system kill session"
: commands so that operations can shutdown the server at
: night cleanly.
 

: The syntax I need to generate looks like this:
 

: alter system kill session 'sid,serial#';
 

: I'm trying to do something like this:
 

: select 'alter system kill session ' || ''' || sid
: || ',' || serial# || '';'
: from v$session
: where username != 'oracle7';
 

: which ( obviously to some gurus ) won't run. Can anybody
: help?
 

: Thanks in advance - Sue
: --
: --------------------------------------------------
: Sue Kudenchak Currently SKud, Formerly Sue Arroyo
: Plan: To grow coconuts in Bora-Bora
: Internet: sarroyo_at_cnj.digex.com

Sue,
You just need to double up on the quotes if you want them to appear inside a
quoted literal. This will work:

select 'alter system kill session ' || ''''|| sid || ',' || serial# || ''';'
from v$session
where username != 'oracle7'

Send a postcard from Bora Bora,

Gary Kirsh
Next Extent, Inc. Received on Mon Jan 09 1995 - 16:49:13 CET

Original text of this message