SQL>
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL> DECLARE
2
3
4 TYPE months_varray IS VARRAY(12) OF STRING(9 CHAR);
5
6
7 TYPE calendar_table IS TABLE OF VARCHAR2(9 CHAR)
8 INDEX BY VARCHAR2(9 CHAR);
9
10
11 month MONTHS_VARRAY := months_varray('January','February','March','April','May','June','July','August');
12
13
14 calendar CALENDAR_TABLE;
15
16 BEGIN
17
18
19 IF calendar.COUNT = 0 THEN
20
21
22 FOR i IN month.FIRST..month.LAST LOOP
23
24
25
26 calendar(month(i)) := '';
27
28
29 DBMS_OUTPUT.PUT_LINE('Index :'||month(i)||' is '||i);
30
31 END LOOP;
32
33
34 FOR i IN calendar.FIRST..calendar.LAST LOOP
35
36 DBMS_OUTPUT.PUT_LINE('Index :'||i||' is '||calendar(i));
37
38 END LOOP;
39
40 END IF;
41
42 END;
43 /
Index :January is 1
Index :February is 2
Index :March is 3
Index :April is 4
Index :May is 5
Index :June is 6
Index :July is 7
Index :August is 8
SQL>
|