Skip to main content

CEIL

Functions › Number · Also written CEILING

Rounds a number up to the next whole number. CEILING is the same function.

Syntax​

{ CEIL | CEILING }( <number> )

Arguments​

ArgumentDescription
<number>A number, or text that reads as a number.

Returns​

An integer argument comes back unchanged, as an integer. Any other argument returns a float with no fraction (4.0). NULL when <number> is NULL. Text that does not read as a number fails the query.

Usage notes​

  • Up means toward positive infinity: CEIL(-3.7) is -3.
  • To get an integer from a float, wrap it: CAST(CEIL(x) AS integer).
  • Runs after the rows are read; it is not pushed to the data store.

Examples​

Boxes needed when a box holds 12 units:

SELECT o.key, o.quantity,
CAST(CEIL(o.quantity / 12.0) AS integer) AS boxes
FROM Order o
keyquantityboxes
O-100303
O-101121
O-10211

See also​

FLOOR · ROUND · TRUNC