Home | Previous Page | Next Page   Creating User-Defined Casts > Understanding Casts >

User-Defined Casts

A user-defined cast is a cast that you define to perform conversion from one UDT to another data type, either built-in or user-defined. You can create user-defined casts to perform conversions between most data types, including opaque types, distinct types, row types, and built-in types.

Opaque Data Types

When you create an opaque data type, you define casts to handle conversions between the internal and external representations of the opaque data type. You might also create casts to handle conversions between the opaque data type and other data types in the database.

For information about how to create and register casts for opaque data types, see Creating Casts for Opaque Data Types.

Distinct Data Types

When you create a distinct data type, the database server automatically registers explicit casts from the distinct data type to the source data type and from the source data type to the distinct data type. You must create casts on distinct types to handle conversions between the new distinct data type and other data types in the database or use explicit casts in your SQL statements.

For more information and examples that show how you can create and use casts for distinct types, refer to the chapter on casting in the IBM Informix: Database Design and Implementation Guide.

Named Row Types

In most cases, you can explicitly cast a named row type to another row type value without creating the cast. However, in some cases, you might want to create a cast that allows for comparisons between a named row type and some other data type.

For information about how to cast between named row types and unnamed row types, refer to the chapter on casting in the IBM Informix: Database Design and Implementation Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]