There is a build-in package : DBMS_UTILITY
This should be able to solve your problem
TABLE_TO_COMMA Procedure
This procedure converts a PL/SQL table of names into a comma-separated list of names. This takes a PL/SQL table, 1..n,
terminated with n+1 null.
Syntax
DBMS_UTILITY.TABLE_TO_COMMA (
tab IN UNCL_ARRAY,
tablen OUT BINARY_INTEGER,
list OUT VARCHAR2);
Bookmarks