Use the Oracle10g Collection API EXTEND method against an element.
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 := number_table(1,2);
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 print_list(number_list);
32
33
34 number_list.EXTEND(2);
35
36
37 number_list.EXTEND(3,2);
38
39 print_list(number_list);
40
41 END;
42 /
List :1
List :2
List :1
List :2
List :
List :
List :2
List :2
List :2
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category