set serveroutput on; declare i number(6); j number(6); cursor c1 is select replace(name,'#@#',',') as name from example; begin

for p in c1 loop if instr(p.name,',',1,1) = 0 then dbms_output.put_line(p.name); end if; j := 1; i := 1; while instr(p.name,',',1,i) > 0 loop dbms_output.put_line(substr(p.name,j,(instr(p.name,',',1,i))-j)); j := instr(p.name,',',1,i)+1; if instr(p.name,',',1,i+1)=0 then dbms_output.put_line(substr(p.name,instr(p.name,',',1,i)+1)); end if; i := i + 1; end loop; end loop; end;

Sign up to vote on this title
UsefulNot useful