Oracle 中查询的字段包含英文单引号、下划线、百分百等特殊字符

1 如有一张表的 其中一个字段中包含英文单引号 【'】

可以用如下SQL查询,插入和修改也是如此:

--监控短信内容包含单引号
select e.* from t_cc_l2_sms_send  e
where e.act_start_dttm > sysdate - 60/1440
and e.sms_type_cd ='100' and e.sms_content like '%''%'
and rownum = 1需要双写单引号即可!
2 如何查询的某一个字段中包含下划线【_】
--用户表 120402
Select *  From T_CC_L2_Employee e Where  e.account_no Like   '%\_%' ESCAPE '\'
Order By e.crt_dttm Desc
3 如何查询某一个字段中包含百分号【%】
Select * From t_cc_l3_property_log P
Where P.log_type ='发短信' And P.case_no Like '%\%%' Escape '\'
 

猜你喜欢

转载自fanjf.iteye.com/blog/1915669
今日推荐