oracle如何拆分以逗號分隔的字符串為多列?
oracle 中可以用connect by把字符串按都好分割:
比如定義字符串:
pv_no_list :='23,34,45,56';
SELECT DISTINCT REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) as "token"
FROM DUAL
CONNECT BY REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) IS NOT NULL
order by 1
返回結果:
TOKEN
23
34
45
56