SELECT *
FROM (WITH temptest AS (SELECT LEVEL lv FROM DUAL connect BY LEVEL <= 10)
select lv,
cnt,
gdm,
substr(vals,
instr(t.vals, ',', 1, ts.lv) + 1,
instr(t.vals, ',', 1, ts.lv + 1) -
(instr(t.vals, ',', 1, ts.lv) + 1)) AS name
from (SELECT g.gdm,
',' || g.gdgr || ',' as vals,
(LENGTH(',' || g.gdgr) - LENGTH(REPLACE(gdgr, ','))) as cnt
FROM MYTEST.GD g) t
join temptest ts on ts.lv <= t.cnt
where gdm = '腾讯'
)
原数据
主要是为了将以逗号存的数据以行的形式展现出来
思路是先获取到数据的长度,然后遍历的时候判断长度,并且,根据这个参数去截取到对应的值,不过效率的方面感觉不咋好