提高sql查询性能-使用instr函数替换like

使用like查询时比较慢,使用oracle的instr函数可以提高查询的效率。

使用like:

select f1.htbh as "htbh",f2.syqr as "cqr",f1.fwzl as "cqzl"
        from FCJY_CLF_MMHT f1
        join FCJY_CLF_MMHT_FWQSGK f2
        on f1.htid = f2.htid
        where f1.htbh like '%1%';

使用instr:

select f1.htbh as "htbh",f2.syqr as "cqr",f1.fwzl as "cqzl"
        from FCJY_CLF_MMHT f1
        join FCJY_CLF_MMHT_FWQSGK f2
        on f1.htid = f2.htid
        where instr(f1.htbh,'1)>0;

猜你喜欢

转载自blog.csdn.net/qq_38152400/article/details/110652470