Blog
DB2utor

Categories

August 02, 2011

Implicit Casting Extended in DB2 10

One detail I find very interesting about DB2 10 is its capability to perform an implicit cast function for an assignment or comparison operation when the data types don't match. IBM designed this feature to make it easier to port applications to DB2 for z/OS.

While previous DB2 for z/OS releases support implicit casting in many cases, casting between a character or graphic string data type to a numeric data type wasn't supported. Prior to DB2 10, DBAs had to manually perform the casting before the assignment or comparison operation. This was a complicated, time-consuming and potentially error-prone process.

In addition to performing the implicit casting of a numeric value to a character or graphic string data type, DB2 10 for z/OS will also perform implicit casting from a character or graphic string into a numeric data type during an assignment or comparison operation.

I’m sure this greatly reduces the complexity of code written in some applications that need to handle this.

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

Does your application require the use of implicit casting? If you've taken advantage of this feature, please share your experiences in Comments.