PL/SQL array

How to use a PL/SQL array

DECLARE
  TYPE year_type IS TABLE OF NUMBER;
  year_sales year_type := year_type();
  tot_sales NUMBER;
 
  CURSOR c IS
  SELECT 1 a
  FROM dual
  UNION ALL
  SELECT 81 a
  FROM dual;
 
BEGIN
  FOR r IN c LOOP
    year_sales.extend();
    year_sales(year_sales.LAST) := r.a;
  END LOOP;
 
  FOR i IN year_sales.FIRST .. year_sales.LAST LOOP
    DBMS_OUTPUT.put_line('Total sales: ' || year_sales(i));
  END LOOP;
 
END;