Mistři v programování na #hovnokod

SQL #4536

Zeby nova syntax Oraclu, o ktorej este neviem? Ale kdeze... ved naco by clovek pouzil LISTAGG, ked moze vytvorit svoju vlastnu funkciu, navyse s takym krasnym nazvom!

select join(
cursor(
select xxx 
FROM yyy, zzz  
WHERE ...
),',')
from dual;


function join
(
    p_cursor sys_refcursor,
    p_del varchar2 := ','
) return varchar2
is
    l_value   varchar2(32767);
    l_result  varchar2(32767);
begin
    loop
        fetch p_cursor into l_value;
        exit when p_cursor%notfound;
        if l_result is not null then
            l_result := l_result || p_del;
        end if;
        l_result := l_result || l_value;
    end loop;
    return l_result;
end join;

Anonymous,