ROUND_TO

Description

Rounds the expression to a fixed number of decimal digits.

Syntax

ROUND_TO(numeric_expression, digits [, mode])

Arguments

  numeric_expression - the value to round (float or double)

  digits - the number of digits to preserve (int)

  mode (optional) - round mode 

Examples

ROUND_TO(3.14151976,3) returns 3.142 

ROUND_TO(42.1,-1) returns 40.0

ROUND_TO(3.5,0,4) returns 4.0 

Return value datatype

The same as numeric_expression's data type.

Impact of null value

If numeric_expression is null, returns null. If digits is null, an error is raised.