Create types and then use it in pl/sql block
SQL>
SQL> CREATE OR REPLACE TYPE unitType AS VARRAY(13) OF VARCHAR2(5 CHAR);
2 /
Type created.
SQL> CREATE OR REPLACE TYPE categoryType AS VARRAY(4) OF VARCHAR2(8 CHAR);
2 /
Type created.
SQL> CREATE OR REPLACE TYPE charArrayType AS TABLE OF VARCHAR2(17 CHAR);
2 /
Type created.
SQL>
SQL> DECLARE
2 counter INTEGER := 0;
3
4 suits categoryType :=categoryType('A','B','C','D');
5 units unitType :=unitType('1','2','3','4','Five','Six','Seven');
6
7 charArray charArrayType := charArrayType();
8 BEGIN
9
10
11
12 FOR i IN 1..counter LOOP
13 dbms_output.put_line('['||charArray(i)||']');
14 END LOOP;
15 END;
16 /
PL/SQL procedure successfully completed.
Related examples in the same category