Extended support for implicit casting

DB2® 10 delivers enhancements that extend support for implicit casting. These enhancements significantly simplify the porting of data to DB2 for z/OS® from other database management systems, where implicit casting is supported.

Previous releases of DB2 for z/OS already support implicit casting in many cases. However, previous releases do not support implicit casting between a character or graphic string type and a numeric type, because character or graphic string types and numeric types are not compatible. In these cases, you must manually code applications to explicitly cast a character or graphic string value to a specific numeric type, before assigning it to a numeric target or comparing it with a numeric value. This process can be time consuming and complicated.

Now, DB2 10 supports the implicit conversion of values from a character or graphic string data type to a numeric data type, or from a numeric data type to a character or graphic string data type. For example, when two operands of an operation, such as assignment or comparison operation, have incompatible data types, DB2 implicitly converts one operand to a data type that is compatible with the other. This enhancement extends the compatibility rules so that character or graphic string data types and numeric data types become compatible. Therefore, a numeric value can be assigned directly to a target of a character or graphic string data type. In addition, a character or graphic string value that is cast to a numeric data type also can be assigned to a target of a numeric data type, or be compared with a numeric value.

LOB data types and binary string types still are not compatible with numeric data types. Casting between these data types is not supported.