简体   繁体   English

oracle-我们如何获得大于或等于的最小数字值

[英]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. 我们如何获得大于或等于Oracle DB中参数的最小数值。 Just like Math.ceil() method in java. 就像Java中的Math.ceil()方法一样。

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. 您可以在查询中使用Oracle CEIL()函数。 From the documentation 文档中

CEIL returns smallest integer greater than or equal to n. CEIL返回大于或等于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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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