Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How to use a ' in dynamic SQL statement
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