Hello..I have some doubts on using DECIMAL datatype in DB2 database.there is one datatype DECIMAL in DB2...can we use this datatype for representing a interger value???..If yes then Is it efficient then Interger Datatype??.....In My Database all the integer values are defined as DECIMAL datatype....How is it Useful here to use Decimal datatype???.....Please solve this problem..
I can't tell you how it is useful to use decimal in your database because I don't know what it is trying to achieve, but if you need to store integers why not just use the integer datatype? there is no advantage to using decimal over integer if you just need integers - in fact its probably a detriment.
A DECIMAL datatype can include a decimal point, giving up to 31 digits of precision. An INTEGER datatype cannot, since it's an integer.
You certainly can use the DECIMAL datatype to represent an integer, although if you're storing an integer you should probably use the INTEGER datatype to prevent confusion.
My best guess as to why your database uses DECIMAL to represent an integer is because DECIMAL affords a larger range: -10*31+1 to 10*31-1. INTEGER only goes from -2,147,483,648 to +2,147,483,647, and BIGINT goes from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.