Skip to main content
Version: V1.0.0

CEIL

Declaration

CEIL(expr)

Description

Returns the smallest integer greater than or equal to expr.

Supports comparison operations. The result is a BOOL value, which is converted to a numeric type. The result is 1 (TRUE) or 0 (FALSE).

If the input is NULL, the return value is NULL.

If the input is a string containing only digits, it is automatically converted to a numeric type.

The return value is converted to a BIGINT.

Examples

SELECT CEIL(1.2), CEIL(-1.2), CEIL(1+1.5), CEIL(1=1),CEIL(1<1),CEIL(null);
+-----------+------------+-------------+-----------+-----------+------------+
| CEIL(1.2) | CEIL(-1.2) | CEIL(1+1.5) | CEIL(1=1) | CEIL(1<1) | CEIL(null) |
+-----------+------------+-------------+-----------+-----------+------------+
| 2 | -1 | 3 | 1 | 0 | NULL |
+-----------+------------+-------------+-----------+-----------+------------+
1 row in set (0.001 sec)

SELECT CEIL(name);
ERROR 1054 (42S22): Unknown column 'name' in 'field list'

SELECT CEIL('2');
+-----------+
| CEIL('2') |
+-----------+
| 2 |
+-----------+
1 row in set (0.001 sec)