循环查询sql带逗号(,)分隔的数据
时间:2014-05-01 02:34:49
收藏:0
阅读:670
1
2
3
4
5
6 |
select
* from
sys_role_list where
id in ( select
c from (with test as
( select
roleid c from
sys_role_info where
id=1) select
substr(t.ca,instr(t.ca, ‘,‘ , 1, c.lv) + 1,instr(t.ca, ‘,‘ , 1, c.lv + 1) - (instr(t.ca, ‘,‘ , 1, c.lv) + 1)) AS c from
( select
‘,‘ || c || ‘,‘
AS ca,length(c || ‘,‘ ) - nvl(length(REPLACE(c, ‘,‘ )), 0) AS cnt FROM test) t, ( select
LEVEL lv from
dual CONNECT BY LEVEL <= 100) c where
c.lv <= t.cnt )) |
评论(0)