有一个表,表名为tab_test,如下:
一、多行转一列
select id, vnum, to_char(wmsys.wm_concat(vname)) c
from tab_test group by id,vnum;
执行上述sql后,如下:
二、一列转多行
with a as (select '/ABC/AA/AD/ABD/JI/CC/ALSKD/ALDKDJ' id from dual)
select regexp_substr(id,'[^/]+',1,rownum) id from a
connect by rownum <= length(regexp_replace(id,'[^/]+'))
执行上述sql后如下:
评论这
posted on 2015-01-23 11:46
fly 阅读(720)
评论(0) 编辑 收藏 所属分类:
数据库学习