Hello there,
I tried to build my own string aggregate function but I've a troubles when I'm using it into my query. When I'm using it, it writes
ORA904, whereas this idenfifier exists. Do you know what's wrong ?
here my aggregate function :
create or replace FUNCTION aggme (query_in in VARCHAR2) RETURN VARCHAR2 IS
incoming varchar2(4000);
hold_result varchar2(4000);
c sys_refcursor;
Begin
open c for query_in;
loop
fetch c into incoming;
exit when c%notfound;
hold_result := hold_result||','||incoming;
end loop;
return ltrim(hold_result,',');
END;
and here my query by using my aggregate function aggme:
select
RES.LASTNAME as "LASTNAME",
RES.FIRSTNAME as "FIRSTNAME",
aggme('select NAME from PATHOLOGY where ID= RES.PATHOLOGY_ID') as "PATHOLOGY"
from
TBK_RESOURCE RES