Solved

Using an apostrophe in LIKE statement

Posted on 2008-10-01
2
1,284 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
2 Comments
 
LVL 142

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now