Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using an apostrophe in LIKE statement

Posted on 2008-10-01
2
Medium Priority
?
1,300 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

715 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