PostgreSQL ceiling() Function

The PostgreSQL ceiling() function returns the smallest integer value that is greater than or equal to the number specified by the argument.

The PostgreSQL ceiling() function ands ceil() function are exactly the same.

ceiling() Syntax

This is the syntax of the PostgreSQL ceiling() function:

ceiling(numeric_value) -> integer

Parameters

numeric_value

Required. A number, it can be positive, negative, or zero, it can be an integer or a decimal.

Return value

The PostgreSQL ceiling() function returns the smallest integer value that is greater than or equal to the number specified by the argument.

The ceiling() function will return NULL if the argument is NULL.

PostgreSQL will give an error if you supply a parameter that is not a numeric type.

ceiling() Examples

Here are a few examples of the ceiling() function:

SELECT
    ceiling(0) AS "ceiling(0)",
    ceiling(10) AS "ceiling(10)",
    ceiling(10.11) AS "ceiling(10.11)",
    ceiling(-10.11) AS "ceiling(-10.11)";
 ceiling(0) | ceiling(10) | ceiling(10.11) | ceiling(-10.11)
------------+-------------+----------------+-----------------
          0 |          10 |             11 |             -10