Home | Previous Page | Next Page   Data Types > Data Type Casting and Conversion >

Using User-Defined Casts

Implicit and explicit casts are owned by the users who create them. They govern casts and conversions between user-defined data types and other data types. Developers of user-defined data types must create certain implicit and explicit casts and the functions that are used to implement them. The casts allow user-defined types to be expressed in a form that clients can manipulate.

For information on how to register and use implicit and explicit casts, see the CREATE CAST statement in the IBM Informix: Guide to SQL Syntax and the IBM Informix: Database Design and Implementation Guide.

Implicit Casts

Implicit casts allow you to convert a user-defined data type to a built-in type or vice versa. The database server automatically invokes a single implicit cast when needed to evaluate and compare expressions or pass arguments. Operations that require more than one implicit cast fail.

Users can explicitly invoke an implicit cast using the CAST AS keywords or the double colon ( :: ) cast operator.

Explicit Casts

Explicit casts, unlike implicit casts or built-in casts, are never invoked automatically by the database server. Users must invoke them explicitly with the CAST AS keywords or with the double colon ( :: ) cast operator.

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