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: <drobinson1_at_my-deja.com>
Date: Tue, 08 Feb 2000 19:04:36 GMT
Message-ID: <87ppc2$uo9$1@nnrp1.deja.com>


Somehow Dejanews changed the two separate single-quote characters in my message into one double-quote character.

What I meant is to use two separate, single-quote characters together and it will be interpreted as a single CHR(39) character within a string, so you don't have to use || CHR(39) ||.

drobinson1_at_my-deja.com wrote:
> Using two quote characters together like this '' will cause it to be
> interpreted as a quote inside the string, rather than as a string
> terminator.
>
> So your SELECT statement would look like this:
>
> sqlString := 'SELECT * FROM table WHERE column = ''Y'' ...';
>
> Of course, this can also get confusing if you have too many quotes
> beside each other and can't figure out what starts where.
>
> If you know that your data will not contain the double-quote character
(
> " ), another approach is to write a function that will replace
> double-quotes with single quotes, so your string would look like this:
>
> sqlString := replacequote('SELECT * FROM table WHERE column = "Y"
...');

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Feb 08 2000 - 13:04:36 CST

Original text of this message

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