WITH t AS ( SELECT 1 id, 'D,A,B,C' v FROM dual UNION ALL SELECT 2, 'Z,W,X,Y' FROM dual ) SELECT id , v , LISTAGG(x, ',') WITHIN GROUP(ORDER BY x) x FROM (SELECT id, v , REGEXP_SUBSTR(v, '[^,]+', 1, lv) x FROM t , (SELECT LEVEL lv FROM dual CONNECT BY LEVEL <= 9) WHERE lv <= REGEXP_COUNT(v, '[^,]+') ) GROUP BY id, v ORDER BY id ;