Numeric type promotion in expressionsIn expressions that use only integer types,
promotes the type of
the result to at least INTEGER. In expressions that mix integer with non-integer
types, promotes the
result of the expression to the highest type in the expression.
The following table shows the promotion of data types in
expressions.
Type promotion in expressionsThis table shows the result of type promotion for each numeric data type when that type is the largest type that appears in an expression.Largest Type That Appears in ExpressionResulting Type of ExpressionDOUBLE PRECISIONDOUBLE PRECISIONREALDOUBLE PRECISIONDECIMALDECIMALBIGINTBIGINTINTEGERINTEGERSMALLINTINTEGER
For example: -- returns a double precision
VALUES 1 + 1.0e0
-- returns a decimal
VALUES 1 + 1.0
-- returns an integer
VALUES CAST (1 AS INT) + CAST (1 AS INT)