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: How to escape % character in LIKE clause

Re: How to escape % character in LIKE clause

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 02 Jan 1999 14:58:30 GMT
Message-ID: <36943336.16527585@192.86.155.100>


A copy of this was sent to zoaibs_at_my-dejanews.com (if that email address didn't require changing) On Sat, 02 Jan 1999 08:02:21 GMT, you wrote:

>Can some one tell me how to search for a field value which contains %; I mean
>how to escape % in LIKE clause TIA
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

by using the ESCAPE keyword with the like clause. For example:

SQL> create table t ( x varchar2(25) ); Table created.

SQL> insert into t values ( '%' );
1 row created.

SQL> insert into t values ( 'A' );
1 row created.

SQL> select * from t where x like '!%' escape '!';

X



%

You can use any escape character you want, I used a '!' in the above example  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

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



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Sat Jan 02 1999 - 08:58:30 CST

Original text of this message

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