ITPub博客

首页 > 数据库 > Oracle > oracle 将一列数据拆分成两列数据

oracle 将一列数据拆分成两列数据

原创 Oracle 作者:abin1703 时间:2016-05-23 18:48:24 0 删除 编辑
将下面的一列的数据拆分成两列数据





select str,
       substr(REPLACE(STR, '  ', '-'),
              1,
              instr(REPLACE(STR, '  ', '-'), '-') - 1) 前,
       substr(REPLACE(STR, '  ', '-'),
              instr(REPLACE(STR, '  ', '-'), '-') + 1,
              length(REPLACE(STR, '  ', '-')) -
              instr(REPLACE(STR, '  ', '-'), '-')) 后
  from (select substr(TRIM(TRANSLATE(desc_info,
                                     trim(TRANSLATE(desc_info,
                                                    '1234567890',
                                                    ' ')),
                                     ' ')),
                      7,
                      1000) str,
               id_user,
               user_name,
               key_info,
               desc_info
        
          FROM (select o.desc_info, id_user, user_name, key_info
                  from gsinfo.t_order o, gsinfo.t_user u
                 where o.id_user = u.id
                   and id_user in
                       (select id
                          from gsinfo.t_user
                         where id_customer = 'CID_00000217')
                   and id_product_order in
                       (select tpo.id
                          from gsinfo.t_user              tu,
                               gsinfo.t_product_order_tpl tpl,
                               gsinfo.t_product_order     tpo
                         where tu.id_customer = 'CID_00000217'
                           and tpl.id = tu.id_product_order_tpl
                           and tpl.id = tpo.id_product_order_tpl
                           and tpo.code_product_tpl = '3')))


          

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30345407/viewspace-2105567/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-07-13

  • 博文量
    204
  • 访问量
    426805