DECLARE
TYPE t1 IS VARRAY (10) OF INTEGER;
TYPE nt1 IS VARRAY (10) OF t1; -- multilevel varray type
va t1 := t1 (2, 3, 5);
-- initialize multilevel varray
nva nt1 := nt1 (va, t1 (55, 6, 73), t1 (2, 4), va);
i INTEGER;
va1 t1;
BEGIN
-- multilevel access
i := nva (2) (3); -- i will get value 73
DBMS_OUTPUT.put_line ('I = ' || i);
-- add a new varray element to nva
nva.EXTEND;
-- replace inner varray elements
nva (5) := t1 (56, 32);
nva (4) := t1 (45, 43, 67, 43345);
-- replace an inner integer element
nva (4) (4) := 1; -- replaces 43345 with 1
-- add a new element to the 4th varray element
-- and store integer 89 into it.
nva (4).EXTEND;
nva (4) (5) := 89;
END;
/
Multilevel VARRAY
0 comments:
Post a Comment