For the syntax that you use to create a user-defined cast, see the CREATE CAST statement in the Informix Guide to SQL: Syntax.
Creating User-Defined Casts To perform conversions between two data types when no cast exists to convert values of one data type to the other, you can create a user-defined cast. A user-defined cast is a cast you create with the CREATE CAST statement. User-defined casts are typically used to provide data type conversions for the following extended data types:
Invoking Casts For system-defined and implicit user-defined casts, the database server automatically (implicitly) invokes the cast to handle the data conversion. For example, you can compare a value of type INT with SMALLINT, FLOAT, or CHAR values without explicitly casting the expression because system-defined casts automatically handle the conversions between these built-in data types. When an explicit cast has been defined to handle conversions between two data types, you must explicitly invoke the cast with the CAST... AS keywords or the double-colon cast operator (::). The following partial examples show the two ways that you can invoke an explicit cast: