round
The round function is used to calculate the value of a rounded to d decimal places.
Syntax
round(DOUBLE a, INT d)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| a | Yes | DOUBLE, BIGINT, DECIMAL, or STRING | Represents the value to be rounded. The format of parameter a includes floating-point format, integer format, and string format. |
| d | No | INT | Default value: 0. Represents the number of decimal places to round to. If parameter d is not of type INT, it is implicitly converted to INT type before evaluation. |
Return Values
Returns a value of type DOUBLE.
- If d is negative, rounding is performed on the |d|-th digit to the left of the decimal point.
- If a or d is NULL, NULL is returned.
Example Code
Returns 123.0.
select round(123.321);
Returns 123.4.
select round(123.396, 1);
Returns NULL.
select round (NULL);
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot