Purpose
This function returns the value of the numeric parameter rounded to the nearest value.
Syntax
ROUND (numeric[,decimal])
Parameters
Parameter |
Description |
|---|---|
| numeric | A NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE expression. |
| decimal |
|
Return type
If
decimalis not specified, the return type is the same as the type of thenumericparameter.If
decimalis specified, the return type is theNUMBERdata type.
Examples
The following examples show the result of rounding 666.666 when decimal is 1, -1, 2.1, and when decimal is not specified.
obclient> SELECT ROUND(666.666,1),ROUND(666.666,-1),ROUND(666.666,2.1),ROUND(666.666) FROM DUAL;
+------------------+-------------------+--------------------+----------------+
| ROUND(666.666,1) | ROUND(666.666,-1) | ROUND(666.666,2.1) | ROUND(666.666) |
+------------------+-------------------+--------------------+----------------+
| 666.7 | 670 | 666.67 | 667 |
+------------------+-------------------+--------------------+----------------+
1 row in set
