转换前和需要转成的格式如下图:
sql语句如下:
SELECT YJKEY, REGEXP_SUBSTR(ADDUSERCD, '[^,]+', 1, LEVEL, 'i') AS ADDUSERCD FROM (SELECT 100000004018 AS YJKEY, '1,2,3' AS ADDUSERCD FROM DUAL) T CONNECT BY LEVEL <= LENGTH(ADDUSERCD) - LENGTH(REGEXP_REPLACE(ADDUSERCD, ',', '')) + 1;
效果如下: