天天看点

oracle 拆分字符串为多行

begin

FOR X IN REVERSE 1 .. 10 LOOP 

insert into T_CORE(wid,name)

  select wid,substr(t,1,instr(t,',',1)-1) from (

select wid,substr(s,instr(s,',',1,rownum)+1)||',' as t,rownum as d ,instr(s,',',1,rownum)+1 from (

select wid,'aaa,bbb'as s from dual where wid =wf

)connect by instr(s,',','1',rownum)>1) yy 

  end loop;

end;