Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Comparison of DOUBLE data type in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
gvshruthi

New User


Joined: 05 Jan 2009
Posts: 4
Location: bangalore

PostPosted: Thu Jan 19, 2012 5:12 pm    Post subject: Comparison of DOUBLE data type in DB2
Reply with quote

Dear All,

I was facing a very strange issue while querying on a DB2 table.
There are 2 volume values i get from 2 columns in 2 different tables and both the fields have the datatype as DOUBLE for the volume field.

I need to update a third table based on the below comparison:

If table1.volume < table2.volume, then update flag in table3 to 'L'.

But for some records where the volume is EQUAL in both table1 and table2, i still find that the table 3 record is updated to 'L'.

But say, if i CAST the 2 fields being compared to CHAR or INT type i do not get the problem. I get this only when i use the datatype DOUBLE.

Can anyone help me on how the comparison takes place for DOUBLE data type in DB2?
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1746
Location: Bloomington, IL

PostPosted: Thu Jan 19, 2012 7:56 pm    Post subject:
Reply with quote

DB2 data type DOUBLE is double-precision floating point (equivalent to COBOL COMP-2). It is unlikely that a decimal quantity can be represented without truncation issues that will lead to the result that you mention. I would inquire of the designer why this column needs to be floating point.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us