Eu tentei a seguinte consulta e obtive o resultado desejado.
SELECT
LISTAGG(X, ',') WITHIN GROUP(
ORDER BY
X
) as result
FROM
(
SELECT
X,
SUM(LENGTH(X)) OVER(
ORDER BY
X
) LENGTH_X,
COUNT(1) OVER(
ORDER BY
X
) - 1 AS COMMAS
FROM
(
SELECT
LEVEL X
FROM
DUAL
CONNECT BY
LEVEL <= 20
)
)
GROUP BY
CEIL((LENGTH_X + COMMAS) / 15);
Saída:
db<>demonstração de violino
Felicidades!!