oracle中的sql优化(instr 代替 like)

— like进行右模糊查询

select count(1) as col_0_0_ from AI_OC_ORDER order0_

where 1=1 and order0_.ORDER_ID like ‘201709200000000005%’ order by order0_.CREATE_TIME desc;

–instr代替like进行右模糊查询

select *  from AI_OC_ORDER order0_

where 1=1 and instr(order0_.ORDER_ID,’201709200000000005′)=1 order by order0_.CREATE_TIME desc;

— like进行全模糊查询

select count(1) as col_0_0_ from AI_OC_ORDER order0_

where 1=1 and order0_.ORDER_ID like ‘%201709200000000005%’ order by order0_.CREATE_TIME desc;

–instr代替like进行全模糊查询

select *  from AI_OC_ORDER order0_

where 1=1 and instr(order0_.ORDER_ID,’201709200000000005′)>0 order by order0_.CREATE_TIME desc;

    原文作者:Tomy_Jx_Li
    原文地址: https://www.jianshu.com/p/18c36f03c661
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞