日期:2014-05-17  浏览次数:20971 次

求大神帮忙看一下字符串分割成行的问题
初始
columnA     columnB
  abe         10
  cd          20
  f            3
    ......


要的结果是这样的
columnA     columnB
   a           10
   b           10
   c           20
   d           20
   e           10
   f            3
    .......

将columnA的字符串一个一个分割出来
求大神指教


------解决方案--------------------
with
t as (select 'abe' colA,10 colB from dual
union all
select 'cd',20 from dual
union all
select 'f',3 from dual),
t1 as (select level id from dual connect by level<=10) 
select substr(t.colA,t1.id,1)colA,t.colB
from t,t1
where t1.id<=length(t.colA)
order by colA;

------解决方案--------------------
楼上正解,  那个 10 应该是max(length(columna))