strange SQL result in QMF and batch



IBM's flagship relational database management system

strange SQL result in QMF and batch

Postby syykwok » Thu Jun 24, 2010 5:58 pm

SELECT X.CNTRY
, (BLA.AMC/12)*C.QXICXXX AS MMMC
, BLA.AMC*C.QXICXXX AS AMC
, (BLA.AMC/12)*C.QXICXXX AS TMC
FROM WCHTXIX X
, WCHTBLA BLA
, WCHTCLC C

When running the above SQL in QMF, the value return for MMMC, AMC, TMC are correct, as in above calculation, AMC is 12 times of MMMC and TMC

However when running the above SQL using batch, the value return for MMMC, AMC, TMC are not correct, AMC is 1.2 times of MMMC and TMC

Anyone got any idea? do I have to put DEC, FLOAT, DOUBLE, etc when dividing, e.g. DEC(BLA.AMC/12)?
syykwok
 
Posts: 4
Joined: Fri Jun 04, 2010 6:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: strange SQL result in QMF and batch

 

Re: strange SQL result in QMF and batch

Postby dick scherrer » Thu Jun 24, 2010 11:30 pm

Hello,

I'm not positive, but i suspect the results of the query posted would be unpredictable. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: strange SQL result in QMF and batch

Postby GuyC » Wed Jun 30, 2010 1:50 pm

I hope you have a join condition somewhere ?
or do tables WCHTXIX and WCHTCLC have only 1 row ?
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: strange SQL result in QMF and batch

Postby Lindovaldo » Tue Jul 06, 2010 9:28 pm

I had similar situation.
In my case, the problem was date format. I need put EUR(column_name)/2, for sample.
It was a problem on configuration parameters on default column type.
Lindovaldo
 
Posts: 5
Joined: Thu Mar 11, 2010 11:56 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post