oracle oracle中如何检查列值是否包含整数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20138570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check if a column value contains integers in oracle
提问by user3020560
Need a query that has to check whether resulting columns have integer.
需要一个必须检查结果列是否为整数的查询。
回答by Rene
First you must know if the value is a number. If it is in a column of type number you don't have to worry about that. To check if the value is an integer you can use the trunc function. This will take the decimal values off.
首先,您必须知道该值是否为数字。如果它在类型编号的列中,则不必担心。要检查该值是否为整数,您可以使用 trunc 函数。这将取消十进制值。
if trunc(value)= value then
-- we have an integer
else
-- we don't
end if;