Q. Write PL/SQL Program For Multilevel Collection Of PL/SQL Table.
Output:
DECLARE
TYPE my_tab IS TABLE OF NUMBER index by PLS_INTEGER;
TYPE my_tab1 is TABLE OF my_tab index by PLS_INTEGER;
tab my_tab1;
Begin
FOR i IN 1..5 LOOP
FOR j IN 1..4 LOOP
tab(i)(j):=i + j;
DBMS_OUTPUT.PUT_LINE('tab('||(i)||')('||(j)||') = '||tab(i)(j));
END LOOP;
END LOOP;
End;
/
tab(1)(1) = 2
tab(1)(2) = 3
tab(1)(3) = 4
tab(1)(4) = 5
tab(2)(1) = 3
tab(2)(2) = 4
tab(2)(3) = 5
tab(2)(4) = 6
tab(3)(1) = 4
tab(3)(2) = 5
tab(3)(3) = 6
tab(3)(4) = 7
tab(4)(1) = 5
tab(4)(2) = 6
tab(4)(3) = 7
tab(4)(4) = 8
tab(5)(1) = 6
tab(5)(2) = 7
tab(5)(3) = 8
tab(5)(4) = 9
PL/SQL procedure successfully completed.
Compatibility (Tested on):
Oracle Database 10g Express Edition Release 10.2.0.1.0 – Product

