Home | Previous Page | Next Page   Object-Relational Databases > Creating and Using User-Defined Casts in Dynamic Server >

What Is a Cast?

A cast is a mechanism that converts a value from one data type to another data type. Casts allow you to make comparisons between values of different data types or substitute a value of one data type for a value of another data type. Dynamic Server supports casts in the following types of expressions:

To convert a value of one data type to another data type, a cast must exist in the database or the database server. Dynamic Server supports the following types of casts:

A user-defined cast is explicit if you include the EXPLICIT keyword when you create a cast with the CREATE CAST statement. (The default is explicit.) Explicit casts are never invoked automatically. To invoke an explicit cast, you must use the CAST...AS keywords or the double colon (::) cast operator.

A user-defined cast is implicit if you include the IMPLICIT keyword when you create a cast with a CREATE CAST statement. The database server automatically invokes implicit casts at runtime to perform data conversions.

All casts are included in the syscasts system catalog table. For information about syscasts, see the IBM Informix: Guide to SQL Reference.

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