Define a varray with a null element constructor and extends it one element at a time by a formula
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE integer_varray
2 AS VARRAY(100) OF INTEGER NOT NULL;
3 /
Type created.
SQL>
SQL> DECLARE
2
3
4 intArray INTEGER_VARRAY := integer_varray();
5
6 BEGIN
7
8
9 FOR i IN 1..intArray.LIMIT LOOP
10
11
12 intArray.EXTEND;
13
14 END LOOP;
15
16 dbms_output.put_line(intArray.COUNT);
17
18 END;
19 /
100
PL/SQL procedure successfully completed.
SQL>