PL/SQL provides three collection types −
Index-by tables or Associative array
Syntax
TYPE type_name IS TABLE OF element_type [NOT NULL] INDEX BY subscript_type;
table_name type_name;
Example
TYPE l_tab_type IS TABLE OF NUMBER INDEX BY VARCHAR2(10);
l_tab l_tab_type;
Variable-size array or Varray
TYPE Foursome IS VARRAY(4) OF VARCHAR2(15);
Nested table
Syntax
TYPE type_name IS TABLE OF element_type [NOT NULL];
table_name type_name;
Example
TYPE l_tab_type IS TABLE OF NUMBER;
l_tab l_tab_type;
TYPE l_rec_type is RECORD (
ID NUMBER,
NAME VARCHAR2(200)
);
TYPE l_tab_type IS TABLE OF l_rec_type;
l_tab l_tab_type;