All Products
Search
Document Center

Numeric precedence

Last Updated: Jun 18, 2021

Different numeric data types have different levels of precedence in operations. In ApsaraDB for OceanBase, BINARY_DOUBLE has the highest precedence, followed by BINARY_FLOAT, and finally by NUMBER.

In any operation on multiple numeric values:

  • If an operand is BINARY_DOUBLE, ApsaraDB for OceanBase converts all operands to

    BINARY_DOUBLE before performing the operation.
  • If an operand is BINARY_FLOAT, ApsaraDB for OceanBase converts all operands to BINARY_FLOAT before performing the operation.

  • If none of the operands is BINARY_DOUBLE or BINARY_FLOAT, ApsaraDB for OceanBase converts all operands to NUMBER before performing the operation.

  • If the required conversion fails, the operation fails.

  • In the context of other data types, numeric data types have lower precedence than the date, time, and interval data types, and have higher precedence than character and all other data types.