Skip to main content

Categories: Math

CEILING

Returns the nearest equal or larger value of the input expression, and can also be called using CEIL(). FLOAT and DOUBLE inputs keep their numeric type, while DECIMAL inputs return a DECIMAL with scale 0 and a precision that may increase when rounding produces a larger whole-number value. Returns NULL if the input is NULL.

Syntax​

CEILING(numeric_expression NUMERIC) → NUMERIC​

  • numeric_expression: The number (DOUBLE, FLOAT, INTEGER, DECIMAL) for which you want to compute the ceiling.

Examples

CEILING example
SELECT CEILING(3.1459)
-- 4
CEILING example
SELECT CEIL(37.775420706711)
-- 38
CEILING example
SELECT CEIL(-37.775420706711)
-- -37
CEILING example
SELECT CEIL(0)
-- 0
Calculate the ceiling of a FLOAT value
SELECT CEILING(CAST(3.14 AS FLOAT))
-- 4.0