Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Looking for fields that contain % or _
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