Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Looking for fields that contain % or _
Have you tried:
SELECT col1 FROM my_table
WHERE ((INSTR(col1,'%',1,1)+1>0) OR (INSTR(col1,'_',1,1)+1>0)) ?
Function INSTR returns the relative position of a character in a string; since the position of the character is relative to the beginning of the string, if % or _ is the first character in col1, INSTR may return a zero (I am not sure about that), that why you need the +1.
I hope this helps.
Michael Serbanescu
Senior Consultant, MIACO Corporation
Received on Sun Mar 23 1997 - 00:00:00 CST