PL/SQL supports two composite data types: collections and records. You can create a collection of records or a record that contains a collection.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
A composite data type stores values that have internal members. You can pass the entire composite variable as a parameter to a subprogram or access the internal members of the composite variable individually. The internal members can be scalar or composite. Scalar members are used with scalar variables, and composite members are used with composite variables of the same type.
In a collection, the internal members always have the same data type, called elements. You can use the variable_name(index) syntax to access each element of a collection variable by its unique index. To create a collection variable, you can first define a collection type and then create a variable of that type, or you can use the %TYPE declaration to specify the type of the variable.
In a record, the internal members can have different data types, called fields. You can use the variable_name.field_name syntax to access each field of a record variable by its name. To create a record variable, you can first define the RECORD type and then create a variable of that type, or you can use the %ROWTYPE or %TYPE declaration to specify the type of the variable.
