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: Looking for fields that contain % or _

Re: Looking for fields that contain % or _

From: Jon <j.m.whitehead_at_sheffield.ac.uk>
Date: 1997/03/24
Message-ID: <3336614A.7CD3@sheffield.ac.uk>#1/1

John Fico wrote:
>
> I am trying to put a like in my where clause so that I can return
> records that have an _ in a specified field. Because _'s and %'s are
> special characters to the like I don't know how to override.
>
> I've tried %% or __. I've also tried set escape on and using \%.
> niether works. Any help would be greatly appreciated.
>
> John Fico

Use the replace function in your sql statement, i.e.

select field1
from table1
where replace(field1,'%','?') like '%?%'

this query will return all rows which have a '%' any where in field1. Consult the SQL language reference manual for an explanation of the replace function.

Jon. Received on Mon Mar 24 1997 - 00:00:00 CST

Original text of this message

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