CREATE OR REPLACE FUNCTION CONCAT_LIST( CURSELECT SYS_REFCURSOR )
RETURN VARCHAR2 IS
RET VARCHAR2(32000);
TMP VARCHAR2(4000);
BEGIN
LOOP
FETCH CURSELECT INTO TMP;
EXIT WHEN CURSELECT%NOTFOUND;
RET :=  RET||TMP||',';
END LOOP;
RETURN RET; 
END;
/