A composite data type stores values that have internal components. You can pass entire composite variables to subprograms as parameters, and you can access internal components of composite variables individually.
Internal components can be either scalar or composite.
You can use scalar components wherever you can use scalar variables. PL/SQL lets you define two kinds of composite data types:
- collection and
You can use composite components wherever you can use composite variables of the same type.
If you pass a composite variable as a parameter to a remote subprogram, then you must create a
redundant loop-back DATABASE LINK, so that when the remote subprogram compiles, the type checker that verifies the source uses the same definition of the user-defined composite variable type
as the invoker uses.
In a collection, the internal components always have the same data type, and are called elements.
You can access each element of a collection variable by its unique index, with this syntax:
variable_name(index). To create a collection variable, you either define a collection type and then create a variable of that type or use %TYPE.
In a record, the internal components can have different data types, and are called fields.
You can access each field of a record variable by its name, with this syntax:
To create a record variable, you either define a RECORD type and then create a variable of that type or use 1) %ROWTYPE or 2) %TYPE.