Precedence of numeric data types

2023-07-28 02:55:42  Updated

Different numeric data types have different priorities. This topic describes precedence rules and considerations for numeric data types in OceanBase Database.

The BINARY_DOUBLE data type has the highest precedence, followed by BINARY_FLOAT, and then by NUMBER.

In an operation on values of different data types, the following conversion rules apply:

  • If one of the operands is of the BINARY_DOUBLE data type, OceanBase Database converts all operands to the BINARY_DOUBLE data type before the operation.

  • If one of the operands is of the BINARY_FLOAT data type and no operand of the BINARY_DOUBLE data type exists, OceanBase Database converts all operands to the BINARY_FLOAT data type before the operation.

  • If no operand is of the BINARY_DOUBLE or BINARY_FLOAT data type, OceanBase Database converts all operands to the NUMBER data type before the operation.

    Notice

    • If the conversion fails, the operation fails.
    • The numeric data types have lower precedence than datetime and interval data types but higher precedence than character data types and all other data types.

Contact Us