第一种方法:
select substr(t,1,instr(t,',',1)-1) from (
select substr(s,instr(s,',',1,rownum)+1)||',' as t,rownum as d ,instr(s,',',1,rownum)+1 from (
select ',tt,aa,bb' as s from dual
)connect by instr(s,',','1',rownum)>1)
查询结果:
SUBSTR(T,1,INSTR(T,',',1)-1)
1 tt
2 aa
3 bb
第二种
select substr(t,1,instr(t,',',1)-1) from (
select substr(s,instr(s,',',1,rownum)+1) as t,rownum as d ,instr(s,',',1,rownum)+1 from (
select ',tt,aa,bb,' as s from dual
)connect by instr(s,',','1',rownum)>1)
where t is not null