oracle登录 管理员账号密码oracle某字段值逗号分隔列转为行实现技巧

oracle某字段值逗号分隔列转为行实现技巧

 

        select substr(x.col_1, x.pos1, x.pos2 – x.pos1 – 1) 

          from (select t.col_1, 

                        level as loracle账号v, 

                        instr(',' || t.col_1 || ',', ',', 1, level) as pos1, 

                        instr(',' || t.col_1 || ',', ',', 1, level + 1) as pos2 

                   from ( 

                         /**将某字段,由逗行分隔的列值转成行**/ 

                         select wm_concat(targetCol) col_1  from tableName                        

                         ) t 

                 connect by level <= (length(t.col_1) – 

                            length(replace(t.col_1, ',', ''))) + 1) x 

  www.2cto.com  

此条目发表在oracle metalink账号分类目录,贴了标签。将固定链接加入收藏夹。