implicit type conversion

When you create a cast in BladeSmith, you can specify whether a cast is called for implicit conversions. Implicit conversions allow the database server to use the cast without it being explicitly called in an SQL statement with the cast operator (::).

For example, if the SUM() function is called with an argument that is a distinct type called dollar, the database server searches for an implicit cast from the dollar data type to a data type for which the SUM() function is defined. If an implicit cast exists, the database server calls the conversion function and then calls the SUM() function without error. If no cast is specified with implicit conversion, the SUM() function call results in an error message from the server.

In this example, you could create an implicit cast from dollar to double precision to permit the server to execute all functions defined for double precision on dollar values. You must be careful about creating implicit casts, however, because some casts can result in a loss of data. For example, if you defined a cast from the dollar data type to the integer data type, you would not want that cast to be implicit, since the conversion function would truncate dollar values, resulting in inaccurate results.

See theInformix® User-Defined Routines and Data Types Developer's Guide for more information about implicit and explicit casts.