Figure 2-6 Complex Data Types Supported by Universal Server
Collection types
Complex data types that are made up of elements, each of which is the same data type.
LIST
A group of ordered elements, each of which need not be unique.
MULTISET
A group of elements, each of which need not be unique. The order of the elements is ignored.
SET
A group of elements, each of which is unique. The order of the elements is ignored.
Row types
Complex data types that are made up of fields.
Named row type
Row types that are identified by their name.
Unnamed row type
Row types that are identified by their structure.
Nesting in Complex Data Types Complex types can be nested. For example, you can construct a row type whose fields include one or more sets, multisets, row types, and/or lists. Likewise, a collection type can have elements whose data type is a row type or a collection type. For a discussion of nested complex types, see Chapter 10, "Understanding Complex Data Types," in the Informix Guide to SQL: Tutorial.
Support Function Inheritance with Complex Data Types All complex types inherit the following support functions:
input
assign
output
destroy
send
LOhandles
recv
hash
import
lessthan
export
equal
import binary
lessthan (ROW only)
export binary
This section summarizes the complex types. For more information on complex types, see Chapter 10, "Understanding Complex Data Types" in the Informix Guide to SQL: Tutorial.
Collection Data Types A collection data type is a complex type made up of one or more elements. Every element in a collection has the same data type. A collection element can have any data type, including other complex types, except TEXT, BYTE, SERIAL, or SERIAL8.
Using Complex Data Types in Table Columns When you specify element values for a collection, list the element values after the constructor and between curly brackets. For example, suppose you have a collection column with the following type:
Row Data Types A row type is a sequence of one or more elements called fields. Each field has a name and a data type. The fields of a row are comparable to the columns of a table, but there are important differences: a field has no default clause, you cannot define constraints on a field, and you cannot use fields with tables, only with row types. Two kinds of row types are: named row types and unnamed row types. Named row types are identified by their names. Unnamed row types are identified by their structure. The structure of an unnamed row type consists of the number and data types of its fields. For more information about the two row types, see pages 2-56 and 2-67.
You can cast between named and unnamed row types. For a discussion of casting, see Chapter 10, "Understanding Complex Data Types"of the Informix Guide to SQL: Tutorial.
Opaque Data Types An opaque data type is a user-defined data type that is fully encapsulated, that is, whose internal structure is unknown to the database server. For more information, see the description given on page 2-58.
Distinct Data Types A distinct data type has the same internal structure as some other source data type in the database. The source data type can be either a built-in type or an extended type. What distinguishes a distinct type from the source type are the functions defined on this type. For more information, see the description on page 2-46.