DEC function in DB2



IBM's flagship relational database management system

DEC function in DB2

Postby sikkandhar » Wed Feb 17, 2016 2:29 am

Hi All,

I have used DEC function in the query and got a question in that

SELECT CASE WHEN A.COL1 = 'A'
THEN DEC((A.COL2 - A.COL4),18,5)
ELSE A.COL5
END

In the table, COL5 has been defined as DECIMAL (16,2), so it would carry 2 decimals

From the above case statement, if the WHEN condition gets satisfied, then the result should have 5 decimals in the result, and if the ELSE gets satisfied, there should be 2 decimals in the result.
But i get 5 decimals for both the conditions. Am not able to understand why there should be 5 decimals returned for COL5, when it has been defined only with 2 decimals in the table.

Thanks in advance
Sikkandhar
sikkandhar
 
Posts: 6
Joined: Tue Jan 13, 2009 1:34 pm
Has thanked: 2 times
Been thanked: 0 time

Re: DEC function in DB2

 

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post