MariaDB CEILING() Function

In MariaDB, CEILING() is a built-in numeric function that returns the smallest integer value greater than or equal to a specified number.

The CEILING() function is equivalent to the CEIL() function.

Use if you want to return the smallest integer value less than or equal to the specified number FLOOR().

If you want to round a number to a specified number of decimal places, use the ROUND() function .

If you want to truncate decimal places by digits, use the TRUNCATE() function.

MariaDB CEILING() Syntax

Here is the syntax of the MariaDB CEILING() function:

CEILING(number)

Parameters

number

Required. A number.

If you provide the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'CEILING'.

Return value

The MariaDB CEILING() function returns the smallest integer value greater than or equal to the specified number.

If the parameter number is NULL, the CEILING() function will return NULL.

MariaDB CEILING() Examples

Here is the syntax of the MariaDB CEILING() function:

SELECT
    CEILING(123.123),
    CEILING(123.789),
    CEILING(123),
    CEILING(-123.123),
    CEILING(-123.789),
    CEILING(-123),
    CEILING(-100),
    CEILING(NULL)\G

Output:

 CEILING(123.123): 124
 CEILING(123.789): 124
     CEILING(123): 123
CEILING(-123.123): -123
CEILING(-123.789): -123
    CEILING(-123): -123
    CEILING(-100): -100
    CEILING(NULL): NULL

Conclusion

In MariaDB, CEILING() is a built-in numeric function that returns the smallest integer value greater than or equal to a specified number.