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 (list_in NUMBER_TABLE) IS
11
12 BEGIN
13
14
15 FOR i IN list_in.FIRST..list_in.LAST LOOP
16
17
18 IF list_in.EXISTS(i) THEN
19 DBMS_OUTPUT.PUT_LINE('List:'||list_in(i));
20
21 END IF;
22
23 END LOOP;
24
25 END print_list;
26
27 BEGIN
28
29
30 IF NOT number_list.EXISTS(1) THEN
31
32
33 number_list := number_table(1,2,3,4,5);
34
35 END IF;
36
37 print_list(number_list);
38
39
40 number_list.DELETE(2,4);
41
42
43 print_list(number_list);
44
45 END;
46 /
List:1
List:2
List:3
List:4
List:5
List:1
List:5
PL/SQL procedure successfully completed.
SQL>
|