Probemos:
Código SQL:
Ver originalDECLARE
CURSOR buscarut (v_email ppl_origen_2.email%TYPE) IS
SELECT DISTINCT RUT_RECEPTOR FROM ppl_origen_2 WHERE email = v_email;
buscarut_c buscarut%ROWTYPE;
TYPE t_mail IS VARRAY(200) OF ppl_origen_2.email%TYPE;
TYPE cadena IS VARRAY(15) OF buscarut_c.RUT_RECEPTOR%TYPE;
v_email t_email;
t_cadena cadena;
i NUMBER :=0;
BEGIN
SELECT DISTINCT email
BULK COLLECT INTO
v_email
FROM ppl_origen_2
WHERE ROWNUM <= 10;
FOR distintos_c IN distintos LOOP
OPEN buscarut(distintos_c.email);
i:=1;
LOOP
FETCH buscarut INTO buscarut_c;
--dbms_output.put_line(buscarut_c.RUT_RECEPTOR);
--t_cadena.extend();
t_cadena(i):= buscarut_c.RUT_RECEPTOR;
EXIT WHEN buscarut%NOTFOUND;
i:=i+1;
END LOOP;
CLOSE buscarut;
END LOOP;
END;