SQL开发知识: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‘;

查询结果如下:

总结

以上所述是小编给大家介绍的SQL开发知识:Oracle字段根据逗号如何分割查询数据的方法,大家如有疑问可以留言,或者联系站长。感谢亲们支持!!!


数据运维技术 » SQL开发知识:Oracle字段根据逗号如何分割查询数据的方法