Define a varray with a three element constructor of null elements.
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL> DECLARE
2
3
4 TYPE integer_varray IS VARRAY(3) OF INTEGER;
5
6
7 intArray INTEGER_VARRAY :=
8 integer_varray(NULL,NULL,NULL);
9
10 BEGIN
11
12
13 FOR i IN 1..3 LOOP
14
15 dbms_output.put ('Integer Varray :'||i);
16 dbms_output.put_line(':'||intArray(i));
17
18 END LOOP;
19
20 intArray(1) := 11;
21 intArray(2) := 12;
22 intArray(3) := 13;
23
24
25 FOR i IN 1..3 LOOP
26 dbms_output.put_line('Integer Varray :'||i||', '||intArray(i));
27 END LOOP;
28
29 END;
30 /
Integer Varray :1:
Integer Varray :2:
Integer Varray :3:
Integer Varray :1, 11
Integer Varray :2, 12
Integer Varray :3, 13
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category