将一个字段的值 按分隔符分成多条记录

with temp as
(
select FILE_PATH as text from TAB_CONTRACT
)
select substr(text,instr(text,',',1,rn)+1,instr(text,',',1,rn+1)-instr(text,',',1,rn)-1) text from
(
select ','||t1.text||',' text,t2.rn from
(select text,length(text)-length(replace(text,',',''))+1 rn from temp) t1,
(select rownum rn from all_objects where rownum <= (select max(length(text)-length(replace(text,',',''))+1) rn from temp)) t2
where t1.rn >= t2.rn order by text,rn
)

posted @ 2018-04-23 13:46  Debugs  阅读(552)  评论(0编辑  收藏  举报