比如sql:
select zyxdm from table where bindid=2265254
查詢結果為:1|4|8|9|10
將這個查詢結果轉成多行,結果如下:
ID 1 4 8 9 10
轉換的sql :
with CTE1 as (select zyxdm from table where bindid=2265254) SELECT REGEXP_SUBSTR((select * from CTE1), '[^|]+', 1, ROWNUM) id FROM DUAL CONNECT BY ROWNUM <= LENGTH((select * from CTE1)) - LENGTH(REPLACE((select * from CTE1), '|', '')) + 1