PL allows you to define two types of composite data types: collection and record. You can create a collection of records and a record containing collections.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
A composite data type stores values of internal members. A composite variable can be passed as a parameter to a subprogram. The internal members of a composite variable can also be independently accessed. Internal members can be scalar or composite. Scalar members are applicable to scalar variables, and composite members are applicable to composite variables of the same type.
Internal members of a collection must use the same data type, and are referred to as elements. You can use the variable_name(index) syntax to access each element in a collection variable by using its unique index. To create a collection variable, you can first define a collection type and then create a variable of this type. You can also use %TYPE to declare a variable type.
Internal members of a record may use different data types, and are referred to as fields. You can use the variable_name.field_name syntax to access each field of a record variable by name. To create a record variable, you can first define a RECORD type and then create a variable of this type. You can also use %ROWTYPE or %TYPE to declare a variable type.