您的位置:首页 > 数据库 > Oracle

Oracle 关键字 escape

2012-07-08 22:33 204 查看
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'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: