Home |
Previous Page | Next Page Object-Relational Databases > Creating and Using User-Defined Casts in Dynamic Server > What Is a Cast? >
When the database server does not provide built-in casts
to perform conversions between two data types, you can create a
user-defined cast to handle the data type conversion. User-defined
casts are typically used to provide data type conversions for the
following extended data types:
- Opaque data types. Developers
of opaque data types must define casts to handle conversions between
the internal/external representations of the opaque data type. For
information about how to create and register casts for opaque data
types, see IBM Informix: User-Defined Routines and Data Types Developer's Guide.
- Distinct data types. You
cannot directly compare a distinct data type to its source type.
However, Dynamic Server automatically registers explicit casts from the distinct
type to the source type and vice versa. A distinct type does not
inherit the casts that are defined on its source type. In addition,
the user-defined casts that you might define on a distinct type
are not available to its source type. For more information and examples that
show how to create and use casts on distinct types, see Creating Cast Functions for User-Defined Casts.
- Named row types. In
most cases, you can explicitly cast a named row type to another
row-type value without having to create the cast. However, to convert
between values of a named row type and some other data type, you
must first create the cast to handle the conversion.
For an example of how to create and use a user-defined cast,
see An Example of Casting Between Distinct Data Types. For the syntax of the CREATE CAST statement,
see the IBM Informix: Guide to SQL Syntax.
Home |
[ Top of Page | Previous Page | Next Page | Contents |
Index ]