SQL>
SQL> set serveroutput on
SQL>
SQL> DECLARE
2 TYPE NumberTab IS TABLE OF NUMBER
3 INDEX BY BINARY_INTEGER;
4 v_Numbers NumberTab;
5 BEGIN
6 FOR v_Count IN 1..10 LOOP
7 v_Numbers(v_Count) := v_Count * 10;
8 END LOOP;
9
10 DBMS_OUTPUT.PUT_LINE('Table elements: ');
11 FOR v_Count IN 1..10 LOOP
12 DBMS_OUTPUT.PUT_LINE(' v_Numbers(' || v_Count || '): ' ||
13 v_Numbers(v_Count));
14 END LOOP;
15
16 BEGIN
17 DBMS_OUTPUT.PUT_LINE('v_Numbers(11): ' || v_Numbers(11));
18 EXCEPTION
19 WHEN NO_DATA_FOUND THEN
20 DBMS_OUTPUT.PUT_LINE(
21 'No data found reading v_Numbers(11)!');
22 END;
23 END;
24 /
Table elements:
v_Numbers(1): 10
v_Numbers(2): 20
v_Numbers(3): 30
v_Numbers(4): 40
v_Numbers(5): 50
v_Numbers(6): 60
v_Numbers(7): 70
v_Numbers(8): 80
v_Numbers(9): 90
v_Numbers(10): 100
No data found reading v_Numbers(11)!
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
|