sql一个列拆分成多列
时间:2010-09-25 来源:新小白龙
substr+instr
SQL> with t as
2 (select 'aa,bbb,cccc' name from dual union all
3 select 'dsad,dll,dsad' from dual)
4 select substr(name,1,instr(name,',')-1) a,
5 substr(name,instr(name,',')+1,instr(name,',',1,2)-instr(name,',')-1) b,
6 substr(name,instr(name,',',1,2)+1) b
7 from t;
A B B
---------------------------------------------------- ---------------------------------------------------- ----------------------------------------------------
aa bbb cccc
dsad dll dsad