2022-07-19 740
oracle怎么查询不包含指定字符
开发过程中遇到个需求,用户要提取的数据列中不包含 YF、ZF、JD的字符串,
方法1:
select * from table where order_no not like '%YF%' and order_no not like '%ZF' and order_no not like '%JD%'
感 觉方法1有点笨,想到REGEXP_LIKE 可以实现包含多个,在前面加上 not 就可以实现不包含功能,方法如下:
方法2:
select * from table where not regexp_like(order_no,'YF|ZF|JD')
两种方法都可以实现,但效率问题,经查询两个月11万条数据做比效方法1用时18秒,方法2用时15秒,连续测试三次方法1总是比方法快2至3秒,如果数据量大的还是建议使用方法1!
原文链接:https://77isp.com/post/2113.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态