CEIL Function

Returns the smallest integer greater than or equal to a numeric value expression.

Category: Truncation
Returned data type: DECIMAL, DOUBLE, NUMERIC

Syntax

CEIL(expression)

Arguments

expression

specifies any valid expression that evaluates to a numeric value.

Data type DECIMAL, DOUBLE, NUMERIC
See <sql-expression>
FedSQL Expressions

Details

If expression is null, then the CEILING function returns null. If the result is a number that does not fit into the range of the argument's data type, the CEIL function fails.
If the argument is DECIMAL, the result is DECIMAL. Otherwise, the argument is converted to DOUBLE (if not so already), and the result is DOUBLE.

Comparisons

Unlike the CEILZ function, the CEIL function fuzzes the result. If the argument is within 1E-12 of an integer, the CEIL function fuzzes the result to be equal to that integer. The CEILZ function does not fuzz the result. Therefore, with the CEILZ function, you might get unexpected results.

Example

The following statements illustrate the CEIL function:
Statements
Results
select ceil(-2.4);
-2
select ceil(1+1.e-11);
2
select ceil(-1+1.e-11);
0
select ceil(1+1.e-13);
1
Last updated: February 23, 2017