I don´t know why i get this error (ORA-06511).
I´m closing the cursor.
procedure send(wmsp_id in number default null) is
pragma autonomous_transaction;
cursor recips(wmsp_id in number) is
select mst.*, rownum, count(*) over () rowcount from (
select mst.* from mspool_to mst where msp_id = wmsp_id order by mst_type desc
) mst;
begin
open recips(wmsp.msp_id);
loop
fetch recips into wrecip;
exit when recips%notfound;
-- my stuff
end loop;
close recips;
end;