Complex data types
A complex data type is built from a combination of
other data types. An SQL statement can access individual components
within the complex type. The two kinds of complex types are as follows:
- Collection types have instances that are groups of
elements of the same data type, which can be any built-in or complex
data type.
The requirements for elements with ordered position and uniqueness among the elements determine whether the collection is a SET, LIST, or MULTISET.
- Row types have instances that are groups of related
data fields, of any data type, that form a template for a record.
The assignment of a name to the row type determines whether the row type is a named row type or an unnamed row type.
The following table summarizes the complex data types that the
database server supports.
Data type | Explanation |
---|---|
LIST(e) | Stores a collection of values that have an implicit position (first, second, and so on) and allows duplicate values All elements have the same element type, e. |
MULTISET(e) | Stores a collection of values that have no implicit position and allows duplicate values All elements have the same element type, e. |
Named row type | A row type created with the CREATE ROW TYPE statement This row type has a defined name and inheritance properties and can be used to construct a typed table. A named row type is not equivalent to another named row type, even if its field definitions are the same. |
ROW (Unnamed row type) | A row type created with the SQL keyword ROW This row type has no defined name and no inheritance properties. Two unnamed row types are equivalent if they have the same number of fields and if corresponding fields have the same data type, even if the fields have different names. |
SET(e) | Stores a collection of values that have no implicit position and does not allow duplicate values All elements have the same element type, e. |