-- bulk.sql

DECLARE
   TYPE PersonCurType IS REF CURSOR;
   TYPE IDList IS TABLE OF NUMBER;
   TYPE NameList IS TABLE OF VARCHAR2(25);
   person_c PersonCurType;
   ids IDList;
   fnames NameList;
   lnames NameList;
BEGIN
   OPEN person_c FOR 'SELECT id, lastname, firstname FROM person';
   FETCH person_c BULK COLLECT INTO ids, lnames, fnames;
   CLOSE person_c;

   EXECUTE IMMEDIATE 'SELECT id FROM person'
      BULK COLLECT INTO ids;
END;
/