SQL>
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL> DECLARE
2
3
4 TYPE number_table IS TABLE OF INTEGER;
5
6
7 number_list NUMBER_TABLE;
8
9
10 PROCEDURE print_list
11 (list_in NUMBER_TABLE) IS
12
13 BEGIN
14
15
16 FOR i IN list_in.FIRST..list_in.LAST LOOP
17
18
19 IF list_in.EXISTS(i) THEN
20
21
22 DBMS_OUTPUT.PUT_LINE('List :'||list_in(i));
23
24 END IF;
25
26 END LOOP;
27
28 END print_list;
29
30 BEGIN
31
32
33 IF NOT number_list.EXISTS(1) THEN
34
35
36 number_list := number_table(1,2,3,4,5);
37
38 END IF;
39
40
41 DBMS_OUTPUT.PUT_LINE('Nested table before a deletion');
42
43
44 print_list(number_list);
45
46
47 number_list.DELETE(2);
48
49
50 DBMS_OUTPUT.PUT_LINE(CHR(10)||'Nested table after a deletion');
51
52
53 print_list(number_list);
54
55 END;
56 /
Nested table before a deletion
List :1
List :2
List :3
List :4
List :5
Nested table after a deletion
List :1
List :3
List :4
List :5
PL/SQL procedure successfully completed.
SQL>
|