How to search data from oracle database which contains single quote

22,107

Solution 1

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 '%''%';

Solution 2

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

Share:
22,107
MAS1
Author by

MAS1

Hard Worker, Eager to learn new things.

Updated on July 20, 2020

Comments

  • MAS1
    MAS1 almost 4 years

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

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