Creating a Varray Type
A varray
stores an ordered set of elements in the same type.
The type can be a built-in database type or a user-defined object type.
Each element is indexed by its position in the array.
You can change elements only as a whole.
The following example creates a type named t_varray that can store up to three VARCHAR2
strings:
SQL> CREATE TYPE t_varray AS VARRAY(3) OF VARCHAR2(50);
2 /
Type created.
SQL>
You can change the maximum number of elements of a varray using the ALTER TYPE
statement.
SQL> ALTER TYPE t_varray MODIFY LIMIT 10 CASCADE;
Type altered.
SQL>
The CASCADE
option propagates the change to any dependent objects in the database.