Oracle is probably the most popular enterprise database server at the moment. This is the server that powers eBay on the web and countless datawarehouses and VLDBs around the world. Oracle is suited for all applications from OLTP to Data Warehousing. The latest 9i even has a built in OLAP engine.
Selecting only integer values from a field
I have a field that has integer and non-integer data. For just this one query, I need to select out only the integer values. How do I make a query ingore any value that has a decimal attached? (I don't need to round... I only want to select the whole numbers.)
Thanks in advance for any help you can provide!
Select * From MyTable
Where The_Number = TRUNC(The_Number);
I think TRUNC with no arguments should do the trick
drop table t;
create table t (f number(4,2));
insert into t values (12.57);
insert into t values (15);
insert into t values (3.8);
select trunc(f) from t;
3 rows selected.
Trunc is still giving me the values that have decimals. I need to completely ignore the values that have decimals and only report out the whole number values.
So, in your example, the only result I would want to product is 15. The other two values should not be part of my result set.
Any other ideas?
Where Trunc(val1) = Val1;
Sorry! You are right. It works perfectly!