Numeric Conversions

Available numeric conversions depend on the datatype characteristics.

Datatype conversions

Datatype

Converts to

Comments

NUMERIC or DECIMAL

SIGNED INTEGER

A NUMERIC or DECIMAL datatype with scale 0 can be converted into a SIGNED INTEGER, provided the precision required to represent the maximum value of the integer is greater than or equal to the precision of the NUMERIC or DECIMAL datatype.

NUMERIC or DECIMAL

INTEGER

NUMERIC or DECIMAL datatypes with a scale other than zero cannot be converted into INTEGERS, and numerics cannot be converted into UNSIGNED INTEGERS.

NUMERIC or DECIMAL

Other NUMERIC or DECIMAL datatypes

A NUMERIC or DECIMAL datatype can be converted into other NUMERIC or DECIMAL datatypes, provided that the scale of the target type is greater than or equal to the scale of the source NUMERIC, and the precision of the target NUMERIC is greater than or equal to the precision of the source NUMERIC plus the difference between the target scale and the source scale.

Examples

Use these examples as a reference for some of the available conversions.

Example 1

NUMERIC(4, 2) can be converted into a NUMERIC(4, 4)
NUMERIC(2, 2) can be converted into a NUMERIC(4, 4)
NUMERIC(2, 4) cannot be converted into a NUMERIC(4, 0)
NUMERIC(2, 4) cannot be converted into a NUMERIC(3, 6)
Related concepts
Unsupported Datatypes
Integer Conversions
Date and Time Conversions
Lookup Tables
Supported Datatypes for Data Transfer
Related reference
Supported Datatypes for Message Flow