bround
This function is used to return a value that is rounded off to d decimal places.
Syntax
bround(DOUBLE a, INT d)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
a |
Yes |
DOUBLE, BIGINT, DECIMAL, or STRING |
The value can be a float, integer, or string. It indicates the value that needs to be rounded. The digit 5 is rounded up if the digit before 5 is an odd number and rounded down if the digit before 5 is an even number. If the value is not of the DOUBLE type, the system will implicitly convert it to the DOUBLE type for calculation. |
d |
No |
DOUBLE, BIGINT, DECIMAL, or STRING |
It indicates the number of decimal places to which the value needs to be rounded. If the value is not of the INT type, the system will implicitly convert it to the INT type for calculation. |
Return Values
The return value is of the DOUBLE type.
If the value of a or d is NULL, NULL is returned.
Example Code
The value 123.4 is returned.
select bround(123.45,1);
The value 123.6 is returned.
select bround(123.55,1);
The value NULL is returned.
select bround(null);
The value 123.457 is returned.
select bround(123.456789,3.123456);
Feedback
Was this page helpful?
Provide feedbackThank 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