Home » RDBMS Server » Server Administration » searching for an underscore in a LIKE statement
searching for an underscore in a LIKE statement [message #371147] Thu, 07 September 2000 05:10 Go to next message
Tom
Messages: 67
Registered: June 1998
Member
Due to the fact that '_' is a reserved character in a LIKE statement, how do I actually search for it?

Is there an escape character that I can use?

Nice one,

Tom.
Re: searching for an underscore in a LIKE statement [message #371148 is a reply to message #371147] Thu, 07 September 2000 07:43 Go to previous message
Thierry Van der Auwera
Messages: 44
Registered: January 2000
Member
Hallo Tom,

You can do this very simple, see example.

SELECT *
FROM tab1
WHERE col1 LIKE '%\_%' ESCAPE '\';

This will return every record where the field col1 contains a '_' in the text.

Hope this is what your looking for.
When not, you can e-mail me.

Greetings,

Thierry
Previous Topic: Oracle Services Question
Next Topic: 'Drop Procedure' Difficulty - Error code :- ORA-04021: timeout occurred while waiting to lock object
Goto Forum:
  


Current Time: Fri Apr 26 02:30:30 CDT 2024