Purpose
ROUND() returns a rounded numeric value.
Syntax
ROUND (numeric[,decimal])
Parameters
| Parameter | Description |
|---|---|
| numeric | An expression of a numeric data type such as NUMBER, FLOAT, BINARY_FLOAT, or BINARY_DOUBLE. |
| decimal |
|
Return type
If you do not specify
decimal, the return type is the same as the data type ofnumeric.If you specify
decimal, the return type isNUMBER.
Examples
The following example rounds 666.666 for cases where the values of decimal are respectively 1, -1, 2.1, and 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