Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to use a ' in dynamic SQL statement

Re: How to use a ' in dynamic SQL statement

From: Jason Morris <morrisj_at_cableregina.com>
Date: Tue, 08 Feb 2000 16:47:34 GMT
Message-ID: <GMXn4.209$EM31.4849770@tomcat.sk.sympatico.ca>


Sorry, I don't understand your explanation....

In article <950025447.27739.0.pluto.d4ee154e_at_news.demon.nl>, postbus_at_sybrandb.demon.nl says...
>
>'SELECT * FROM table WHERE column = ''Y'' ... '; so escape the character by
>itself should work.
>
>Hth,
>
>Sybrand Bakker, Oracle DBA
>
>
>Jason Morris <morrisj_at_cableregina.com> wrote in message
>news:otWn4.207$EM31.4391005_at_tomcat.sk.sympatico.ca...
>> Hi all, hope there is an easier way to do this.
>>
>> I'm using dynamic SQL in a stored procedure, and would like to do
>something
>> like this:
>>
>> sqlString := 'SELECT * FROM table WHERE column = 'Y' ... ';
>>
>> Now the "column='Y'" causes problems, because it thinks they're string
>> terminators. Is there an escape character or something similar? In SQL
>Server
>> it was just " column=''Y'' ".
>>
>> Right now I'm stuck doing:
>> column = ' || chr(39) || 'Y' || chr(39) || ' .... '
>> but this strikes me as ugly, and there should be a better way (I'd like to
>> think).
>>
>> Comments? (And yes, I must use dynamic SQL, it's not an option)
>>
>> Thanks for any help
>> Jason Morris
>> morrisj_at_cableregina.com
>>
>
>
Received on Tue Feb 08 2000 - 10:47:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US