oracle 中 SPLIT_PART 报错:ORA-00904:”SPLIT_PART“ :标识符无效,怎么解决?

SELECT SPLIT_PART('aaa,111', ',', 1) AS Part1,
       SPLIT_PART('aaa,111', ',', 2) AS Part2
 from dual;

报错:SPLIT_PART标识符无效,求解

1675143121662.png

1675143283533.png

我本来目的是想把下面的WJMC2列 按,拆分成多个行,不要在一行,隔开。请教有什么好方法
1675143568286.png

阅读 2.8k
1 个回答

试一下这个 splitting-string-into-multiple-rows-in-oracle

with temp as
         (select 3260481 REQUESTID, '957543,976795' WJMC2
          from dual
          union all
          select 3260484, '1005870,1021425,1041219'
          from dual)
select distinct t.REQUESTID,
                trim(regexp_substr(t.WJMC2, '[^,]+', 1, levels.column_value)) as error
from temp t,
     table (cast(multiset(select level
                          from dual
                          connect by level <= length(regexp_replace(t.WJMC2, '[^,]+')) + 1) as sys.OdciNumberList)) levels
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏