Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL 'ESCAPE' Problem

Re: SQL 'ESCAPE' Problem

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/06/29
Message-ID: <33bcde3e.29738281@newshost>#1/1

Your using the escape for the wrong purpose. the escape character can be defined so you can search for a string that has a % or _ in it (instead of like interpreting them as wildcards). For example

select * from emp where ename like 'K%\%' escape '\'

would search for anything that started with K and ended with %.

To get a quote in a character string, which seems to be what you want, you would:

select * from emp where ename like 'K%''%G'

the 2 quotes will be interpreted as one. This says find everythat that starts with K, has a ' in the middle and ends in G....

On Sat, 28 Jun 97 23:43:23 GMT, NoSpam_at_interaccess.com (Andre Allen) wrote:

>Hello Everyone
>
>I am having trouble with the following SQL Statement
>
>select loc_description
>where loc_description like 'Joe^'s%'
>escape '^'
>
>It seems that I can use the escape character on anything other than a single
>quote mark. The problem is, in mu customer table, I need to track and
>search for names like "Joe's computers" or "Bill's hot dogs". Am I doing
>something wrong?
>
>Any responses would be appreciated
>
>Andre Allen
>NoSpam_at_interaccess.com
>to reply, Please replace "NoSpam" with "andre"

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sun Jun 29 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US