Need a query that has to check whether resulting columns have integer.
Asked
Active
Viewed 2.0k times
5
-
1The question is similar but not a duplicate. Checking for number is not the same as checking for integer. – Rene Nov 22 '13 at 07:03
-
@Rene Agreed. This is not a duplicate. In fact, in terms of the information sought, the approach(es) to the answer, and the probable use case, it is distinct from the other question. That designation should be removed. – WAF Sep 10 '15 at 16:23
1 Answers
9
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.
if trunc(value)= value then
-- we have an integer
else
-- we don't
end if;

Rene
- 10,391
- 5
- 33
- 46
-
4If it's a numeric column, there is also `if mod(value,1) != 0...`, which works great for me. – WAF Sep 10 '15 at 16:44
-