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://www.cnblogs.com/yanglang/p/10058405.html