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 -> How to use a ' in dynamic SQL statement

How to use a ' in dynamic SQL statement

From: Jason Morris <morrisj_at_cableregina.com>
Date: Tue, 08 Feb 2000 15:18:44 GMT
Message-ID: <otWn4.207$EM31.4391005@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:18:44 CST

Original text of this message

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