CEIL

functionsupportedCore SQL functions

docs.snowflake.com ↗

Numeric functions

Returns values from input_expr rounded to the nearest equal or larger integer, or to the nearest equal or larger value with the specified number of places after the decimal point.

Syntax

supportedpartialnot supportednot scored

CEIL( <input_expr> [, <scale_expr> ] )

Parameters

NameRequiredDescription
input_exprrequiredThe value or expression to operate on. The data type must be one of the numeric data types, such as DECFLOAT, FLOAT, or NUMBER.
scale_exprrequiredThe number of digits the output includes after the decimal point. The default scale_expr is zero, meaning that the function removes all digits after the decimal point. For information about negative scales, see Usage notes.

Returns

The return type is based on the input type: - If the input expression is a FLOAT, the returned type is a FLOAT. - If the input expression is DECFLOAT, the returned type is DECFLOAT. - If the input expression is a NUMBER, the returned type is a NUMBER. If the input scale is constant: If the input scale is positive, the returned type has a scale equal to the input scale and has a precision large enough to encompass any possible result. - If the input scale is negative, the returned type has a scale of 0. - If the input scale isn’t constant, the returned type’s scale is the same as the input expression’s. If the scale is zero, then the value is effectively an INTEGER. For example: - The data type returned by CEIL(3.14::FLOAT, 1) is FLOAT. - The NUMBER returned by CEIL(3.14, 1) has scale 1 and precision at least 3. - The NUMBER returned by CEIL(-9.99, 0) has scale 0 and precision at least 2. - The NUMBER returned by CEIL(33.33, -1) has scale 0 and precision at least 3.

Usage notes

See also

Referenced by