Reply-To: "Michael O'Neill" <mjoneill@email.com>
From: "Michael O'Neill" <mjoneill@email.com>
Newsgroups: comp.databases.oracle.server
References: <916el8$ci5$1@nnrp1.deja.com>
Subject: Re: SQL query "10%" in a field
Lines: 35
Organization: Bottom Line Party
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <WpBZ5.19736$x6.11241610@news2.rdc2.tx.home.com>
Date: Wed, 13 Dec 2000 02:46:14 GMT
NNTP-Posting-Host: 24.11.25.230
X-Complaints-To: abuse@home.net
X-Trace: news2.rdc2.tx.home.com 976675574 24.11.25.230 (Tue, 12 Dec 2000 18:46:14 PST)
NNTP-Posting-Date: Tue, 12 Dec 2000 18:46:14 PST


<shiuhlin@jshape.com> wrote in message news:916el8$ci5$1@nnrp1.deja.com...
> Hi,
>
>   I have a problem needs  help. My problem is : I have a table called
 "DOCS"
> which contains a field called "NEWS", and I like to perform a query to
 find
> all records  which contains "10%" key words in the NEWS field. The "%" in
> "10%"  (10 - percent)  isn't  the wildcard character used in SQL. Now, can
> anyone show me how to find the "10%" in NEWS?
>
> SELECT NEWS FROM DOCS WHERE NEWS LIKE ?????
>
> Shiuh-Lin Lee

Use ESCAPE.

SELECT *
  FROM docs
 WHERE news LIKE '%10/%%' ESCAPE '/';


Directly from SQL Reference, Release 8.1.5 :
ESCAPE identifies a single character as the escape character. The escape
character can be used to cause Oracle to interpret % or _
literally, rather than as a special character.
If you wish to search for strings containing an escape character,
you must specify this character twice. For example, if the
escape character is ’/’, to search for the string ’client/server’,
you must specify, ’client//server’.
--
Michael O'Neill
mjoneill@email.com



