DECLARE /* This version can only be used in PL/SQL Release 2.3 and beyond. */ /* The cursor against the database table. */ CURSOR company_cur IS SELECT company_id, name FROM company; /* The PL/SQL table TYPE based on the cursor. */ TYPE company_tabtype IS TABLE OF company_cur%ROWTYPE INDEX BY BINARY_INTEGER; company_table company_tabtype; next_row INTEGER; BEGIN /* The cursor FOR loop */ FOR company_rec IN company_cur LOOP /* Get last row used and add one. */ next_row := company_table.LAST + 1; /* Set the row values for ID and dates. */ company_table.company_id (next_row) := company_rec.company_id; company_table.incorp_date (next_row) := company_rec.incorp_date; company_table.filing_date (next_row) := company_rec.filing_date; END LOOP; END;