Underscore is not working in oracle like clause

2019-01-25 08:10发布

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 '\''.

2条回答
一纸荒年 Trace。
2楼-- · 2019-01-25 08:41

In Oracle, you can also use ESCAPE like this:

SELECT * FROM name_of_table WHERE description LIKE 'testing\_%' ESCAPE '\';
查看更多
戒情不戒烟
3楼-- · 2019-01-25 08:48

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%';
查看更多
登录 后发表回答