Integer type promotion

In some cases, EQL supports automatic value promotion of integers to doubles when there is no risk of loss of information.

Promotion of integers to doubles occurs in the following contexts:
  • Arguments to the COALESCE expression when called with a mix of integer and double.
  • Arguments to the following operators when called with a mix of integer and double:

    + - * = <> < <= > >= BETWEEN

  • Integer arguments to the following functions are always converted to double:
    • / (division operator; note that duration arguments are not converted)
    • CEIL
    • CORRELATION
    • COS
    • EXP
    • FLOOR
    • IN
    • LN
    • LOOKUP
    • LOG
    • SIN
    • MOD
    • POWER
    • SIN
    • SQRT
    • TAN
    • TO_GEOCODE
    • TRUNC
  • When the clauses in a CASE expression return a mix of integer and double results, the integers are promoted to double.

For example, in the expression 1 + 3.5, 1 is an integer and 3.5 is a double. The integer value is promoted to a double, and the overall result is 4.5.

In contexts other than the above, automatic type promotion is not performed and an explicit conversion is required. For example, if Quantity is an integer and SingleOrder is a Boolean, then an expression such as the following is not allowed:
COALESCE(Quantity, SingleOrder)
An explicit conversion from Boolean to integer such as the following is required:
COALESCE(Quantity, TO_INTEGER(SingleOrder))