简体   繁体   中英

oracle - How do we get the smallest number value that is greater than or equal

How do we get the smallest number value that is greater than or equal to the argument in Oracle DB. Just like Math.ceil() method in java.

For eg,

0.625 -> needs to return 1
0.2 -> needs to return 1
1.2 -> needs to return 2
1.0 -> needs to return 1

You can use the Oracle CEIL() function in your query. From the documentation

CEIL returns smallest integer greater than or equal to n.

This function takes as an argument any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The function returns the same datatype as the numeric datatype of the argument.

for instance:

SELECT CEIL(column) FROM table;

在Oracle中使用ceil函数!

select ceil(.625) from dual;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM