Jeg prøvede følgende forespørgsel og opnåede det ønskede resultat.
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);
Output:
Skål!!