RPG (IBM i / AS/400) · DB2 SQLCODE

SQLCODE -420 - Invalid Character Value for Cast

What does SQLCODE -420 - Invalid Character Value for Cast mean in RPG (IBM i / AS/400)?

A CAST, or an implicit conversion such as assigning a character string to a numeric host variable, was given a string that isn't a valid representation of the target type - for example non-numeric text passed into a numeric conversion.

SQLCODE -420 - Invalid Character Value for CastDB2 for i · SQLRPGLE

Condition

A CAST, or an implicit conversion such as assigning a character string to a numeric host variable, was given a string that isn't a valid representation of the target type - for example non-numeric text passed into a numeric conversion.

Fix

Validate that the source string is actually numeric before casting it, and scan for embedded blanks or stray characters that commonly leak in from flat-file or user-entered data.

Related db2 sqlcode