日期:2014-05-17 浏览次数:20806 次
--创建一个中间表,把execle数据先导进中间表,
create table temp(
shidm varchar2(50),
shinm varchar2(50),
zhennm varchar2(500)
)
insert into temp value ('1234','虚拟市1','A,B,C,D,E,F,G,H,I');
insert into temp value ('5678','虚拟市2','J,K,L,M');
commit;
select * from temp;
select t1.shidm,
t1.shinm,
t1.shidm
------其他解决方案--------------------
lpad(r, 2, '0') zhendm,
substr(t1.zhennm, 2 * r - 1, 1) zhennm
from temp t1,
(select rownum r
from dual
connect by rownum <=
(select max(length(replace(zhennm, ','))) from temp)) t2
where length(replace(t1.zhennm, ',')) >= r
order by t1.shidm, t1.shinm, t2.r
SHIDM SHINM ZHENDM ZHENNM
-------------------------------------------------- -------------------------------------------------- ------------------------------------------------------ ------
1234 虚拟市1 123401