How is the CEIL function used in Oracle?

In Oracle, the CEIL function is used to return the smallest integer that is greater than or equal to the specified number. The syntax of this function is as follows:
CEIL(number)
Here, the number is a numerical expression that can be a number, date, time, or datetime.

Here are some examples:

  1. The CEIL(10.3) function will return 11, as 11 is the smallest integer that is greater than or equal to 10.3.
  2. The CEIL(5) function will return 5 because 5 is already an integer.
  3. If you use the CEIL function on -3.9, it will return -3 because -3 is the smallest integer that is greater than or equal to -3.9.

Please note that the result returned by the CEIL function is a floating-point number. If you need to convert it to an integer, you can use the CAST function or pass it as a parameter to the TO_NUMBER function. For example, CAST(CEIL(10.3) AS INT) will return the integer value of 11.

bannerAds