Solved

Using an apostrophe in LIKE statement

Posted on 2008-10-01
2
1,292 Views
Last Modified: 2013-12-18
Using Oracle 10g.  Is it possible to use an apostrophe in a like statement?  
Example
Select * from test where col like '%apostrophe_here%'
If tried:
col like '%\'%' escape = '\'
col like '%'''%'   (3 single quotes)
col like '%''''%'   (4 single quotes)
col like '%||chr(39)||%'  
None of these worked.  Any ideas?
0
Comment
Question by:edwardui
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22618386
try:
Select * from test where col like '%''%'

Open in new window

0
 

Author Comment

by:edwardui
ID: 22618468
That's the trick.  Thank you.  I had tried two single quotes before but had never removed the escape = '\' clause.  Looked like Select * from test where col like '%''%' escape = '\'
So with out the escape clause your response worked.  Didn't think the escape would cause an error if there were no \ in the like.
Thank you
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question