Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape single quotes in Oracle? [duplicate]

Tags:

sql

oracle

I have a column containing certain expressions stored as a text string which include single quotatons, such as 'missed transaction' (INCLUDING the quotations)

How can I use a where clause with such an occurance?

select * from table where reason = ''missed transaction''

doesn't work, and I can't use the replace function because it also requires single quotations in its syntax. Obscure problem, i know. But thanks for any help.

like image 257
Kevin Avatar asked Nov 28 '22 20:11

Kevin


1 Answers

You need to escape the ' by doubling them :

select * from table where reason = '''missed transaction''';
like image 198
Jean-François Savard Avatar answered Dec 10 '22 02:12

Jean-François Savard