The extensible data type system allows you to:
You can define the following extended data types:
The database server stores information about extended data types in the sysxtdtypes and sysxtdtypeauth system catalog tables. For information about these tables, refer to the IBM Informix: Guide to SQL Reference.
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:
The requirements for elements with ordered position and uniqueness among the elements determine whether the collection is a SET, LIST, or MULTISET.
The assignment of a name to the row type determines whether the row type is a named row type or an unnamed row type.
Table 6 summarizes the complex data types that the database server supports.
Table 7 summarizes the UDTs that the database server supports.
Data Type | Explanation |
---|---|
Distinct | Has the same internal representation as the source data type on which it is based but has different casts and functions defined over it than those on the source type |
Opaque | Fundamental data type that the user defines A fundamental data type is atomic; that is, it cannot be broken into smaller pieces, and it can serve as the building block for other data types. |
In an ANSI-compliant database, columns defined using user-defined types should be in the owner.object format.
A distinct type has the same internal structure as an existing data type. However, it has a distinct name and therefore distinct functions that make it different from its source type. When you define a distinct type, you provide the following information:
The functions of the source data type determine how the database server interacts with this internal structure.
You define operator functions, built-in functions, or end-user routines that handle the distinct type. For information about building operator functions, see Extending Operators and Built-In Functions.
For information about support functions, see Writing Support Functions.
The database server automatically creates explicit casts between the distinct type and its source type. Because these two data types have the same internal format, this cast does not require a cast function. You can write cast functions to support data conversion between the distinct type and other data types in the database or to support implicit casts between the distinct type and its source data type. For information about writing casts, see Creating User-Defined Casts.
You create a distinct data type with the CREATE DISTINCT TYPE statement. After you create the distinct type, you can use it anywhere that other data types are valid. For more information, refer to the description of this statement in the IBM Informix: Guide to SQL Syntax.
Unlike other data types (built in, complex, and distinct), the internal structure of the opaque data type is not known to the database server. Therefore, when you define an opaque type, you must provide the following information:
You define the support functions of the opaque type to tell the database server how to interact with this internal structure.
You define operator functions, built-in functions, or end-user routines that handle the opaque type.
The support functions of the opaque type also serve as cast functions.
You register an opaque data type with the CREATE OPAQUE TYPE statement. For information about this statement, refer to the IBM Informix: Guide to SQL Syntax. For more information, see Creating an Opaque Data Type, and Writing Support Functions.
In addition to the extended data types that you explicitly define, you can use the pre-packaged extended data types that are provided. For example, an IBM Informix DataBlade module might contain the routines required to support a spherical coordinate system. For more information on IBM Informix DataBlade modules, consult your sales representative or refer to the user guides for the DataBlade modules.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]