oracle的替代品,转--oracle中替代LIKE方法

论坛 期权论坛 脚本     
已经匿名di用户   2022-4-26 16:03   2453   0

Oracle中替换like的方法关键词:

数据库中存储了海量的数据,当查询时使用like,速度明显变慢。我在做项目时,发现可以使用instr函数来取代like的作用。

1.%a%方式:

select * from pub_yh_bm t

where instr(t.chr_bmdm,'2')>0

等份于:

select * from pub_yh_bm t

where t.chr_bmdm like '%2%'

2.%a方式:

select * from pub_yh_bm t

where instr(t.chr_bmdm,'110101')=length(t.chr_bmdm)-length('110101')+1

等份于:

select * from pub_yh_bm t

where t.chr_bmdm like '%110101'

3.a%方式:

select * from pub_yh_bm t

where instr(t.chr_bmdm,'11010101')=1

等份于:

select * from pub_yh_bm t

where t.chr_bmdm like '11010101%'

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP