create or replace procedure SP_H04_02 is
type type_rec is record (gbdatum medewerkers.gbdatum%type,
naam medewerkers.naam%type);
type type_col1_med
is table of type_rec;
t_med type_col1_med;
BEGIN
select gbdatum, naam
bulk collect into t_med
from medewerkers
order by gbdatum;
dbms_output.put_line('Hier onder de 4 namen van de oudste medewerkers');
v_index := t_med.first;
while v_index is not null
loop
dbms_output.put_line(t_med(v_index).naam);
exit while v_index >= 4;
v_index := t_med.next;
end loop;
END;