Assign value to varchar2 collection by index
SQL>
SQL> DECLARE
2 TYPE charArrayType IS TABLE OF VARCHAR2(5 CHAR);
3
4 charArray charArrayType := charArrayType(NULL,NULL,NULL);
5 BEGIN
6
7 FOR i IN 1..3 LOOP
8 dbms_output.put ('charArray Varray:'||i);
9 dbms_output.put_line(':'||charArray(i));
10 END LOOP;
11
12 charArray(1) := 'A';
13 charArray(2) := 'B';
14 charArray(3) := 'C';
15
16 FOR i IN 1..3 LOOP
17 dbms_output.put_line(i||':'||charArray(i));
18 END LOOP;
19 END;
20 /
charArray Varray:1:
charArray Varray:2:
charArray Varray:3:
1:A
2:B
3:C
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category