Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search data from oracle database which contains single quote

my_table contains three columns: name, address1, and address2.

I want to find all records which contains single quotes. How can I do this?

like image 933
MAS1 Avatar asked Dec 03 '22 11:12

MAS1


2 Answers

You have to escape the single quotes in the expressions by doubling them, e.g.:

select * from my_table
where name like '%''%'
or address1 like '%''%'
or address2 like '%''%';
like image 181
Frédéric Hamidi Avatar answered May 03 '23 04:05

Frédéric Hamidi


... where name || address1 || address2 like '%''%';

like image 44
dg157 Avatar answered May 03 '23 05:05

dg157