CEILING()

Documentation

VoltDB Home » Documentation » Using VoltDB

CEILING()

CEILING() — Returns the smallest integer value greater than or equal to a numeric expression.

Synopsis

CEILING( numeric-expression )

Description

The CEILING() function returns the next integer greater than or equal to the specified numeric expression. In other words, the CEILING() function "rounds up" numeric values. For example:

CEILING(3.1415) = 4
CEILING(2.0) = 2
CEILING(-5.32) = -5

Example

The following example uses the CEILING function to calculate the shipping costs for a product based on its weight in the next whole number of pounds.

SELECT shipping.cost_per_lb * CEILING(product.weight),
       product.prod_id FROM product
       JOIN shipping ON product.prod_id=shipping.prod_id
       ORDER BY product.prod_id;