Underscore is not working in oracle like clause

Ramesh picture Ramesh · Jan 27, 2014 · Viewed 28.2k times · Source

When development, I used 'test_1%' to find 'test_123' in like. But in production environment its not working. Using 'escape '\'' is working. is there any setting needs to set in oracle? I want to use without escape '\''.

Answer

Hamidreza picture Hamidreza · Jan 27, 2014

try this in SQL Developer:

SELECT * FROM TABLE1 WHERE NAME LIKE 'test\_1%' escape '\'

in sql plus:

set escape '\'
SELECT * FROM TABLE1 WHERE NAME LIKE 'test\_1%';