Casting Rules

FromToResults in
INTEGERSTRINGASCII or EBCDIC representation of the value
DECIMALSTRINGASCII or EBCDIC representation of the value, including decimal and sign
REALSTRINGASCII or EBCDIC representation of the value, including decimal and sign--may be expressed in scientific notation
UNICODESTRINGASCII or EBCDIC representation with any non-existent characters appearing as the SUBstitute control code (0x1A in ASCII or 0x3F in EBCDIC) and any non-valid ASCII or EBCDIC characters appearing as the substitution codepoint (0xFFFD)
UTF8STRINGASCII or EBCDIC representation with any non-existent characters appearing as the SUBstitute control code (0x1A in ASCII or 0x3F in EBCDIC) and any non-valid ASCII or EBCDIC characters appearing as the substitution codepoint (0xFFFD)
STRINGQSTRINGUppercase ASCII representation
INTEGERUNICODEUNICODE representation of the value
DECIMALUNICODEUNICODE representation of the value, including decimal and sign
REALUNICODEUNICODE representation of the value, including decimal and sign--may be expressed in scientific notation
INTEGERUTF8UTF8 representation of the value
DECIMALUTF8UTF8 representation of the value, including decimal and sign
REALUTF8UTF8 representation of the value, including decimal and sign--may be expressed in scientific notation
INTEGERREALValue is cast with loss of precision when the value is greater than 15 significant digits
INTEGERREAL4Value is cast with loss of precision when the value is greater than 7 significant digits
STRINGREALSign, integer, and decimal portion of the string value
DECIMALREALValue is cast with loss of precision when the value is greater than 15 significant digits
DECIMALREAL4Value is cast with loss of precision when the value is greater than 7 significant digits
INTEGERDECIMALLoss of precision if the DECIMAL is too small
REALDECIMALLoss of precision if the DECIMAL is too small
STRINGDECIMALSign, integer, and decimal portion of the string value
STRINGINTEGERSign and integer portions of the string value
REALINTEGERInteger value, only--decimal portion is truncated
DECIMALINTEGERInteger value, only--decimal portion is truncated
INTEGERBOOLEAN0 = FALSE, anything else = TRUE
BOOLEANINTEGERFALSE = 0, TRUE = 1
STRINGBOOLEAN'' = FALSE, anything else = TRUE
BOOLEANSTRINGFALSE = '', TRUE = '1'
DATASTRINGValue is cast with no translation
STRINGDATAValue is cast with no translation
DATAUNICODEValue is cast with no translation
UNICODEDATAValue is cast with no translation
DATAUTF8Value is cast with no translation
UTF8DATAValue is cast with no translation
UTF8UNICODEValue is cast with no translation
UNICODEUTF8Value is cast with no translation

The casting rules for STRING to and from any numeric type apply equally to all string types, also. All casting rules apply equally to sets (using the SET OF type syntax).