您的位置: CNOUG博客首页 >> 论坛 >> Oracle开发应用 >> 查看帖子
字体: 小 中 大 | 打印 发表于: 2008-9-18 09:27 作者: wxrwin 来源: CNOUG博客首页
最新回复
redneck_he (2008-9-18 18:11:53)
SQL> insert into demo values(12,3,'45;78;9;');
1 row inserted
SQL> commit ;
Commit complete
SQL> select c1,c2,substr(c3,
decode(rownum,1,1,instr(c3,';',1,rownum-1)+1),
instr(c3,';',1,rownum)-decode(rownum,1,1,instr(c3,';',1,rownum-1)+1)) c3
from demo connect by rownum <= length(c3) - length(replace(c3,';',''));
C1 C2 C3
---- ---- ----------------------------------------
12 3 45
12 3 78
12 3 9
redneck_he (2008-9-18 18:14:18)
shaozb (2008-9-22 16:19:43)
select decode(a,12) as col_a,decode(b,3) as col_b,
case when instr(c,'45;')>0 then
45
when instr(c,'78;')>0 then
78
when instr(c,'9;')>0 then
9
...
else
...
end as col_c
from tab ;
shaozb (2008-9-22 17:04:14)