How to search on the Oracle wildcard characters

by Granville Bonyata on October 22, 2013

Ever need to search for a string value that includes % or _ and end up with unwanted results because those are the Oracle search wildcards?

The solution is simple – ESCAPE!

SELECT *
FROM dba_tables
WHERE table_name LIKE '%INV^_DETAIL1_' ESCAPE '^'

Now the % and the second underscore will be used as wildcards, but the underscore prefixed by ^ will be treated as an actual underscore in the search.

Previous post:

Next post: