Oracle Number Function - Oracle/PLSQL CEIL Function






This Oracle tutorial explains how to use the Oracle/PLSQL CEIL function.

Ceil returns next highest integer value regardless of the fraction. The next highest refers to the actual higher number whether positive or negative.

Syntax

The syntax for the Oracle/PLSQL CEIL function is:

CEIL( number )

number is the value used to find the smallest integer value.

Example


--   w ww.ja  v  a 2s.c om
SQL> select ceil(1.1) from dual;

 CEIL(1.1)
----------
         2

SQL> select ceil(1.9) from dual;

 CEIL(1.9)
----------
         2

SQL> select ceil(-1.1) from dual;

CEIL(-1.1)
----------
        -1

SQL> select ceil(-1.9) from dual;

CEIL(-1.9)
----------
        -1

SQL> select ceil(0) from dual;

   CEIL(0)
----------
         0

SQL>




Example 2

Using the ROUND, CEIL, and FLOOR Functions

select round(345.678, 0), ceil(345.678), floor(345.678)
from  dual;

ROUND(345.678)  CEIL(345.678) FLOOR(345.678)
-------------- ------------- --------------
346                      346                        345