If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Windows 7/64bit, DB2 odbc drive and overflow

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-26-10, 07:24
duhaas duhaas is offline
Registered User
 
Join Date: Aug 2010
Posts: 18
Windows 7/64bit, DB2 odbc drive and overflow

I keep getting:

ERROR: [IBM][CLI Driver][DB2/NT64] SQL0413N Overflow occurred
during numeric data type conversion. SQLSTATE=22003

Query
= SELECT
acct.PI as AbacusID,
acct.PN,
acct.AM,

acct.T1,
acct.MG,
summ.DT,
summ.cc_code1,

cast(summ.TWRR as decimal(18,8)),
summ.*
FROM

PORTATTR acct
left join SUMMRET summ
on acct.PI = summ.PI
WHERE acct.PN = '9841M287003'

When i dont cast summ.TWRR its giving me the scientific representation of the number and I would prefer to see the actual number. Not sure if it has to do with me using an odbc driver or what, any suggestions would be great. I've tried increasing the decimal up and its not helping. New to DB2 so please go easy on me. Also,if i change the filter to in this case to a different account, sometime it will come back fine other not. I understand its due to the number exceeding the length of the decimal i'm casting, but if i dont know what the potential max could be I'm a bit lost

Last edited by duhaas; 08-26-10 at 07:27.
Reply With Quote
  #2 (permalink)  
Old 08-26-10, 08:11
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
How about casting to decfloat?

Here is an example:
Code:
------------------------------ Commands Entered ------------------------------
SELECT double_float
     , DECFLOAT(double_float) AS cast_to_decfloat
  FROM (VALUES 1.23456789E+15 , 1.23456789E-5 ) AS d(double_float)
;
------------------------------------------------------------------------------

DOUBLE_FLOAT             CAST_TO_DECFLOAT                          
------------------------ ------------------------------------------
  +1.23456789000000E+015                           1234567890000000
  +1.23456789000000E-005                            0.0000123456789

  2 record(s) selected.
Reply With Quote
  #3 (permalink)  
Old 08-26-10, 08:31
duhaas duhaas is offline
Registered User
 
Join Date: Aug 2010
Posts: 18
Thanks TON, that allows the results to come back now. I actually tried DOUBLE_PRECISION and that seemed to work as well. just doesnt like decimal.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On