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: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 8 Feb 2000 16:55:10 +0100
Message-ID: <950025447.27739.0.pluto.d4ee154e@news.demon.nl>


'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 - 09:55:10 CST

Original text of this message

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