What is the difference between number and binary_double in Oracle?
The main advantage is: it is more efficient than number, faster, and takes less space, but the version compatibility is poor.
Numeric numeric type
- Number: this is a real decimal data type. It is also the only numeric type in PL/SQL that is fully platform-independent.
- PlsInteger and binaryInteger: The two integer types are exactly the same as the underlying hardware representation.
- SimpleInteger: it and binaryInteger has the same value range, but cannot be null, and no exception is thrown in case of overflow.
- BinaryFloat and binaryDouble: the two are single-precision, double-precision binary floating point types in the IEEE-754 standard respectively.
- SimpleFloat and simpleDouble: They and binaryFloat and binaryDouble has the same gathering range, but it cannot be null. In case of overflow, no exception is thrown, and special direct quantities or predicates are not supported.
Number:
Oracle databases allocate a maximum of 40 numbers to empty orders, and the decimal point is also optimized based on the value given to the variable. The value range is 1.0e-130 to 1.0e126-1. A value smaller than the minimum value is rounded down to 0. If the value of the calculation result is greater than the maximum value, undefined is triggered, resulting in a running error but no exception is thrown.
Number (precision, scale)-permissionis the total number of valid numbers in this value. The range is 1-38-scale, indicating the number of digits on the right (positive scale) or left (negative scale) of the decimal point. Range:-84-127
Binary_float and binary_double types
Oracle has a mandatory priority for implicit conversions of floating point types. The highest to lowest priority is binary.Double, binaryFloat, number
**************************************** **************************************** **
Rounding and truncation Functions
- Cell: returns the smallest integer greater than or equal to the specified value.
- Floor: returns the maximum integer that is less than or equal to the specified value.
- Found: rounds a number.
- Trunc: truncates a number by a specified number of decimal places.