declare
cursor c_names is
select n.firstname from NedMcDodd n where n.type = 18;
type names_pt is table of varchar2(30) index by binary_integer;
l_names names_pt;
begin
-- fill up the collection by selecting from the table
open c_names;
loop
fetch c_names into l_names(l_names.count + 1);
exit when c_names%notfound;
end loop;
close c_names;
-- display the contents of the collection
for l_indx in l_names.first .. l_names.last loop
dbms_output.put_line(l_indx || ') ' || l_names(l_indx));
end loop;
end;