Oracle CEIL() Function
The Oracle (PL/SQL) CEIL() function returns the next highest integer value by rounding up the specified number, if necessary. In other words, it rounds the fraction UP of the given number.
Syntax
CEIL(x)
Parameters
x |
Required. Specify a number. |
Return Value
Returns the next highest integer value by rounding UP the specified number, if necessary.
Example 1:
The example below shows the usage of CEIL() function.
CEIL(23) Result: 23 CEIL(23.3) Result: 24 CEIL(23.8) Result: 24 CEIL(-23) Result: -23 CEIL(-23.3) Result: -23 CEIL(-23.8) Result: -23
Example 2:
Consider a database table called Sample with the following records:
Data | x |
---|---|
Data 1 | -10.75 |
Data 2 | -5.38 |
Data 3 | 0.98 |
Data 4 | 13.16 |
Data 5 | 48.13 |
The statement given below can be used to round the fraction UP for all records of column x.
SELECT Sample.*, CEIL(x) AS CEIL_Value FROM Sample;
This will produce the result as shown below:
Data | x | CEIL_Value |
---|---|---|
Data 1 | -10.75 | -10 |
Data 2 | -5.38 | -5 |
Data 3 | 0.98 | 1 |
Data 4 | 13.16 | 14 |
Data 5 | 48.13 | 49 |
❮ Oracle Functions