Oracle字段根据逗号分割查询数据的方法
需求是表里的某个字段存储的值是以逗号分隔开来的,要求根据分隔的每一个值都能查出来数据,但是不能使用like查询。
数据是这样的:
查询的sql如下:
select * from ( select guid, regexp_substr(st_responsible, ‘[^,]+‘, 1, level) responsible from tt_cancle_responsible connect by level <= regexp_count(st_responsible, ‘,‘) + 1 and guid = prior guid and prior dbms_random.value is not null ) where responsible =‘wyy‘;
查询结果如下:
总结
相关推荐
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16
ktyl000 2020-08-16
dbasunny 2020-08-16