The ROUND function returns the rounded value of the numeric parameter.
Syntax
ROUND (numeric[,decimal])
Parameters
| Parameter | Description |
|---|---|
| numeric | The expression of the numeric types: NUMBER, FLOAT, BINARY_FLOAT, and BINARY_DOUBLE. |
| decimal | If decimal is greater than or equal to 0, numeric is rounded to the number of decimal places specified by decimal. If decimal is less than 0, the numeric value is rounded to the specified number of digits to the left of the decimal point. The number of digits is specified by decimal. If decimal is not an integer, the integer part of decimal is truncated. If you do not specify decimal, numeric is rounded to the integer. |
Return type
If you do not specify decimal, the return type is the same as the data type of the numeric parameter. If you specify decimal, the return type is the NUMBER data type.
Examples
This example shows the results of rounding 5555.6666 under different values of decimal.
Execute the following statement:
SELECT ROUND(5555.6666, 2.1), ROUND(5555.6666, -2.6), ROUND(5555.6666) FROM DUAL;
The following query result is returned:
+----------------------+-----------------------+------------------+
| ROUND(5555.6666,2.1) | ROUND(5555.6666,-2.6) | ROUND(5555.6666) |
+----------------------+-----------------------+------------------+
| 5555.67 | 5600 | 5556 |
+----------------------+-----------------------+------------------+