SQL>
SQL> CREATE OR REPLACE TYPE varray_one IS VARRAY(10)OF NUMBER;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE varray_one_nested IS VARRAY(10)OF varray_one;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE varray_two_nested IS VARRAY(10)OF varray_one_nested;
2 /
Type created.
SQL>
SQL> DECLARE
2 v1 varray_one;
3 v2 varray_one_nested;
4 v3 varray_two_nested;
5 BEGIN
6 v1 :=varray_one(1,2,3);
7
8 v2 :=varray_one_nested(varray_one(11,12,13),varray_one(21,22,23));
9
10 v3 :=varray_two_nested(
11 varray_one_nested(varray_one(111,112,113),varray_one(121,122,123)),
12 varray_one_nested(varray_one(211,212,213),varray_one(221,222,223)));
13
14 for i in 1..v1.count loop
15
16 dbms_output.put_line(v1(i));
17
18 end loop;
19
20 for i in 1..v2.count loop
21
22 for j in 1..v2(i).count loop
23
24 dbms_output.put_line(v2(i)(j));
25
26 end loop;
27
28 end loop;
29
30 for i in 1..v3.count loop
31
32 for j in 1..v3(i).count loop
33
34 for k in 1..v3(i)(j).count loop
35
36 dbms_output.put_line(v3(i)(j)(k));
37
38 end loop;
39
40 end loop;
41
42 end loop;
43
44 END;
45 /
1
2
3
11
12
13
21
22
23
111
112
113
121
122
123
211
212
213
221
222
223
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> drop type varray_one force;
Type dropped.
SQL>
SQL> drop type varray_one_nested force;
Type dropped.
SQL>
SQL> drop type varray_two_nested force;
Type dropped.
SQL>
SQL>
|