CREATE OR REPLACE FUNCTION anual(monthh in varchar2, an IN VARCHAR2) return anual_REP_var PIPELINED is BR anual_REP:=anual_REP(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL); contor INT(2); an_in VARCHAR2(4); luna_in varchar2(2); Begin contor := to_number(trim(monthh)); --the number of iterations an_in := trim(an); -- For tmp in 1..contor loop br:=anual_monthh('28-'||tmp||'-'||an_in); --function that returns the situation for one month --(must run it 12 times with different parameter) - i need to get cumulated situation --error trown --PLS-00653: aggregate/table functions are not allowed in PL/SQL scope pipe ROW(BR); END loop; return; END anual;