Different numeric data types have different priorities when performing operations. This topic describes the priority rules for numeric data types in OceanBase Database.
In OceanBase Database, BINARY_DOUBLE has the highest priority, followed by BINARY_FLOAT, and NUMBER has the lowest priority.
When performing operations on numeric values of different data types, the conversion rules are as follows:
If one of the operands is of type
BINARY_DOUBLE, OceanBase Database converts all operands toBINARY_DOUBLEbefore performing the operation.If one of the operands is of type
BINARY_FLOATand none of the other operands are of typeBINARY_DOUBLE, OceanBase Database converts all operands toBINARY_FLOATbefore performing the operation.If none of the operands are of type
BINARY_DOUBLEorBINARY_FLOAT, OceanBase Database converts all operands toNUMBERbefore performing the operation.Notice
- If the required data type conversion fails, the operation will fail.
- Compared to other data types, numeric data types have a lower priority than date and time interval data types, but a higher priority than character and other data types.
