Numeric operands

Numeric types are compatible with other numeric and character-string and graphic-string data types.

If one operand column is... And the other operand is... The data type of the result column is...
SMALLINT SMALLINT SMALLINT
SMALLINT String INTEGER
INTEGER SMALLINT INTEGER
INTEGER INTEGER INTEGER
INTEGER String INTEGER
BIGINT SMALLINT BIGINT
BIGINT INTEGER BIGINT
BIGINT BIGINT BIGINT
BIGINT String BIGINT
DECIMAL(w,x) SMALLINT
DECIMAL(p,x) where
p = min(mp, x+max(w-x,5))
mp = 31 or 63 (See Note 1)
DECIMAL(w,x) INTEGER
DECIMAL(p,x) where
p = min(mp, x+max(w-x,11))
mp = 31 or 63 (See Note 1)
DECIMAL(w,x) BIGINT
DECIMAL(p,x) where
p = min(mp, x+max(w-x,19))
mp = 31 or 63 (See Note 1)
DECIMAL(w,x) DECIMAL(y,z) or NUMERIC(y,z,)
DECIMAL(p,s) where
p = min(mp, max(x,z)+max(w-x,y-z))
s = max(x,z)
mp = 31 or 63 (See Note 1)
DECIMAL(w,x) String
DECIMAL(w,x)
NUMERIC(w,x) SMALLINT
NUMERIC(p,x) where
p = min(mp, x + max(w-x,5))
mp = 31 or 63 (See Note 1)
NUMERIC(w,x) INTEGER
NUMERIC(p,x) where
p = min(mp, x + max(w-x,11))
mp = 31 or 63 (See Note 1)
NUMERIC(w,x) BIGINT
NUMERIC(p,x) where
p = min(mp, x + max(w-x,19))
mp = 31 or 63 (See Note 1)
NUMERIC(w,x) NUMERIC(y,z)
NUMERIC(p,s) where
p = min(mp, max(x,z) + max(w-x, y-z))
s = max(x,z)
mp = 31 or 63 (See Note 1)
NUMERIC(w,x) String
NUMERIC(w,x)
NONZERO SCALE BINARY NONZERO SCALE BINARY
NONZERO SCALE BINARY
(If either operand is nonzero scale binary,
both operands must be binary with the
same scale.)
REAL REAL REAL
REAL DECIMAL, NUMERIC, BIGINT, INTEGER, or SMALLINT DOUBLE
REAL String DOUBLE
DOUBLE any numeric type DOUBLE
DOUBLE String DOUBLE
Notes:
  1. The value of mp is 63 if:
    • either w or y is greater than 31, or
    • a value of 63 was specified for the maximum precision on the DECRESULT parameter of the CRTSQLxxx command, RUNSQLSTM command, or SET OPTION statement
    Otherwise, the value of mp is 31.