round function

Returns the rounded expr using HALF_UP rounding mode.

Syntax

round(expr [,targetScale] )

Arguments

  • expr: A numeric expression.

  • targetScale: An INTEGER expression greater or equal to 0. If targetScale is omitted the default is 0.

Returns

If expr is DECIMAL the result is DECIMAL with a scale that is the smaller of expr scale and targetScale.

In HALF_UP rounding, the digit 5 is rounded up.

Examples

> SELECT round(2.5, 0);
 3
> SELECT round(2.6, 0);
 3
> SELECT round(3.5, 0);
 4
> SELECT round(2.25, 1);
 2.2