Chcete-li to provést, musíte deklarovat nový blok:
for t in y loop
DECLARE
cursor X IS (
SELECT DISTINCT s.NIF PREMISE,a.COD_UNICOM READING, A.COD_LECT_AREA AREA
FROM SUMCON s, LECT_AREAS a
WHERE a.COD_UNICOM = t.FCODE
AND s.NUM_SUM IN (select num_sum from RFC_UPD_NEW_MRSP_POOL where cod_unicom = t.FCODE)
);
BEGIN
for met in x loop
...
end loop;
END;
Nicméně nechápu, proč nemůžete tento kurzor jednoduše deklarovat spolu s kurzorem y, definovaným parametrem:
cursor X (p_FCODE RFC_UPD_NEW_MRSP_POOL.cod_unicom%TYPE) IS (
SELECT DISTINCT s.NIF PREMISE,a.COD_UNICOM READING, A.COD_LECT_AREA AREA
FROM SUMCON s, LECT_AREAS a
WHERE a.COD_UNICOM = p_FCODE
AND s.NUM_SUM IN (select num_sum from RFC_UPD_NEW_MRSP_POOL where cod_unicom = p_FCODE)
);
Potom byste mohli odkazovat na kurzor takto:
FOR met IN x(t.FCODE) LOOP