MariaDB CEIL() FUnction
In MariaDB, CEIL()
is a built-in numeric function that returns the smallest integer value greater than or equal to a specified number.
The CEIL()
function is equivalent to CEILING()
.
if you want to return the smallest integer value less than or equal to the specified number, Use the FLOOR()
function.
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 CEIL()
Syntax
Here is the syntax of the MariaDB CEIL()
function:
CEIL(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 'CEIL'
.
Return value
The MariaDB CEIL()
function returns the smallest integer value greater than or equal to the specified number.
If the parameter number
is NULL
, the CEIL()
function will return NULL
.
MariaDB CEIL()
Examples
The following statement shows the basic usage of the MariaDB CEIL()
function:
SELECT
CEIL(123.123),
CEIL(123.789),
CEIL(123),
CEIL(-123.123),
CEIL(-123.789),
CEIL(-123),
CEIL(-100),
CEIL(NULL)\G
Output:
CEIL(123.123): 124
CEIL(123.789): 124
CEIL(123): 123
CEIL(-123.123): -123
CEIL(-123.789): -123
CEIL(-123): -123
CEIL(-100): -100
CEIL(NULL): NULL
Conclusion
In MariaDB, CEIL()
is a built-in numeric function that returns the smallest integer value greater than or equal to a specified number.