I have a script that uses one VARRAY multiple times. But, I can't seem to figure out how to reset the VARRAY after looping through it once. I wrote the following basic script to help me troubleshoot:
DECLARE
   TYPE multi_show_id_type IS VARRAY (60) OF VARCHAR2 (10);
   multi_show_id multi_show_id_type := multi_show_id_type ();
   counter       NUMBER := 1;
   i             NUMBER := 1;
BEGIN
   DBMS_OUTPUT.put_line ('BEGIN');
   WHILE i < 10
   LOOP
   DBMS_OUTPUT.put_line (i);
   --counter:=0;
   --multi_show_id :=multi_show_id_type();
   --multi_show_id.delete;
   WHILE counter < 25
   LOOP
   multi_show_id.EXTEND ();
   multi_show_id (counter) := counter * counter;
   DBMS_OUTPUT.put_line ('VArray: [' || counter || '] [' || multi_show_id (counter) || ']');
   counter := counter + 1;
   END LOOP;
   i := i + 1;
   END LOOP;
   DBMS_OUTPUT.put_line ('END');
END;
/
This script works when it is only looping through the array once. But if you uncomment the counter:=0 line, which forces it to loop through the array population loop 10 times, I get an ORA-06532 error. You can see some of the stuff I've tried in the other commented lines. Any help would be appreciated.