SQL> DECLARE
2 TYPE charArrayType IS TABLE OF VARCHAR2(5 CHAR);
3
4 charArray charArrayType := charArrayType();
5 BEGIN
6 FOR i IN 1..3 LOOP
7 charArray.EXTEND;
8 IF i = 1 THEN
9 charArray(i) := 'A';
10 ELSIF i = 2 THEN
11 charArray(i) := 'B';
12 ELSIF i = 3 THEN
13 charArray(i) := 'C';
14 END IF;
15 END LOOP;
16
17 FOR i IN 1..3 LOOP
18 dbms_output.put (i||':');
19 dbms_output.put_line(charArray(i));
20 END LOOP;
21 END;
22 /
1:A
2:B
3:C
PL/SQL procedure successfully completed.
|