Oracle 关键字 escape

来源:互联网 发布:网络快车软件有哪些 编辑:程序博客网 时间:2024/05/23 17:01


escape
escape是转义字符的关键字,用于转义通配符,提取字段字符里有通配符值的记录。
select f.*
from temp_ltao f
where b like '字符串' escape '/'; 


将字符串中/后面的字符转义。
// 转义/ 
/% 转义% 
/_ 转义_


例如:
select f.*,f.rowid
from temp_ltao f
where b like '%/%%' escape '/'; --转义第二个%


但需要注意'例外,字符'还是需要用两个''来代替字符串中的单引号 
例如:
select * from t_char where a like 'a\'b' escape '\';
ERROR:ORA-01756: quoted string not properly terminated 
正确:
select * from t_char where a like 'a''b'