Use nested table constructors.
SQL>
SQL> set serveroutput on
SQL>
SQL> DECLARE
2 TYPE NumbersTab IS TABLE OF NUMBER;
3
4
5 v_Tab1 NumbersTab := NumbersTab(-1);
6
7
8 v_Primes NumbersTab := NumbersTab(1, 2, 3, 5, 7);
9
10
11 v_Tab2 NumbersTab := NumbersTab();
12 BEGIN
13
14
15 v_Tab1(1) := 12345;
16
17
18 FOR v_Count IN 1..5 LOOP
19 DBMS_OUTPUT.PUT(v_Primes(v_Count) || ' ');
20 END LOOP;
21 DBMS_OUTPUT.NEW_LINE;
22 END;
23 /
1 2 3 5 7
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category