Extend with null element to the maximum limit size.
SQL>
SQL> DECLARE
2 TYPE number_varray IS VARRAY(5) OF INTEGER;
3 number_list NUMBER_VARRAY := number_varray(1,2,3);
4
5 PROCEDURE print_list(list_in NUMBER_VARRAY) IS
6 BEGIN
7 FOR i IN list_in.FIRST..list_in.COUNT LOOP
8 DBMS_OUTPUT.PUT_LINE('List Index ['||i||'] '||'List Value ['||list_in(i)||']');
9 END LOOP;
10 END print_list;
11 BEGIN
12 print_list(number_list);
13
14 number_list.EXTEND(number_list.LIMIT - number_list.LAST);
15
16 print_list(number_list);
17 END;
18 /
List Index [1] List Value [1]
List Index [2] List Value [2]
List Index [3] List Value [3]
List Index [1] List Value [1]
List Index [2] List Value [2]
List Index [3] List Value [3]
List Index [4] List Value []
List Index [5] List Value []
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category