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_DOUBLEdata type, OceanBase Database converts all operands to theBINARY_DOUBLEdata type before the operation.If one of the operands is of the
BINARY_FLOATdata type and no operand of theBINARY_DOUBLEdata type exists, OceanBase Database converts all operands to theBINARY_FLOATdata type before the operation.If no operand is of the
BINARY_DOUBLEorBINARY_FLOATdata type, OceanBase Database converts all operands to theNUMBERdata 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.