This function expects cursor as an Input parameter , where the function reads the content from the cursor and concatenates using delimeter.
CREATE OR REPLACE FUNCTION Concatenate_List (p_cursor IN SYS_REFCURSOR)
RETURN VARCHAR2
IS
l_return VARCHAR2(32767);
l_temp VARCHAR2(32767);
BEGIN
LOOP
FETCH p_cursor
INTO l_temp;
EXIT WHEN p_cursor%NOTFOUND;
l_return := l_return || ',' || l_temp;
END LOOP;
CLOSE p_cursor;
RETURN LTRIM(l_return, ',');
END;
/
No comments:
Post a Comment