The Oracle CEIL function, short for “ceiling”, will return the smallest integer value greater than the specified number. In other words, it rounds up to the nearest whole number.
It’s the opposite of the FLOOR function, which rounds down.
The syntax of CEIL is:
The number parameter can be any numeric data type. The CEIL function will return a number in the same data type as the parameter.
So, you can use CEIL with decimal numbers, which is actually where CEIL works best. You can use it with whole numbers too. It won’t show an error, it just might display the same value as provided (e.g. CEIL(8) would be 8).
You can also use functions inside CEIL. For example, CEIL(SUM(salary)) will SUM all of the salary values, and then round them up to the nearest whole number.
Like with all functions, the Oracle CEIL function can also use column aliases. So, instead of having your column labelled “CEIL(8.12)” or “CEIL(salary)”, you can label your column “salary_rounded” or something that makes more sense.
The CEIL function is similar to the ROUND function. However, ROUND will round up or down, where CEIL will always round up. The TRUNC function will also do some kind of rounding, but it removes decimals from a number which may cause it to “round” down.
For more information, including the code used in the examples, read the related article here: