SQL/MX 3.1 Reference Manual (H06.23+, J06.12+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.1 Reference Manual663850-001
9-51
Considerations
If all the possible return values are fixed-length character types, the return value is
a fixed-length character string equal to the maximum size of all the possible return
value types.
If any of the possible return values are variable-length character types, the return
value is a variable-length character string with maximum size of all the possible
return value types.
If all the possible return values are integer types, the return value is of the same
data type as the largest integer type of all the possible return value types.
If the return value is FLOAT, the precision is the maximum precision of all the
possible return values.
If all the possible return values are of the same non-integer, numeric type (REAL,
FLOAT, DOUBLE PRECISION, NUMERIC, or DECIMAL), the return value is of the
same type.
If all the possible return values are numeric types but not all the same, and at least
one is REAL, FLOAT, or DOUBLE PRECISION, the return value is a DOUBLE
PRECISION type.
If all the possible return values are numeric types but not all the same, none are
REAL, FLOAT, or DOUBLE PRECISION, and at least one is of type NUMERIC, the
return value is NUMERIC type.
If all the possible return values are numeric types, none are NUMERIC, REAL,
FLOAT, or DOUBLE PRECISION, and at least one is of type DECIMAL, the return
value is DECIMAL type.
If the return value is of type NUMERIC or DECIMAL, the value has a precision
value equal to the sum of:
°
The maximum scale of all the return values.
°
The maximum of precision minus scale value for all the return values.
However, the precision value must not exceed 18.
If the return value is of type NUMERIC or DECIMAL, the scale of the return value
is the minimum of:
°
The maximum scale of all the return values.
°
18 - (the maximum of precision minus scale value for all the return values).
There is no limit on the number of components in the DECODE function (includes
expr,test_exprs,retval, and the default ) other than the general limit of
an SQL expression. However, large lists of components do not perform well.
Note. Existing NonStop SQL/MX conversions rules are applied to the above
rules.