好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Oracle字段根据逗号分割查询数据的方法

需求是表里的某个字段存储的值是以逗号分隔开来的,要求根据分隔的每一个值都能查出来数据,但是不能使用like查询。

数据是这样的:

查询的sql如下:

?

1

2

3

4

5

6

7

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‘;

查询结果如下:

总结

以上所述是小编给大家介绍的Oracle字段根据逗号分割查询数据的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://www.mamicode.com/info-detail-2402086.html

查看更多关于Oracle字段根据逗号分割查询数据的方法的详细内容...

  阅读:82次