DB2 - Problembeschreibung
Problem IC70488 | Status: Geschlossen |
SUM DOUBLE COLUMN WITH VALUES THAT ARE CLOSE TO ZERO MAY RESULT IN INTERMEDIATE VALUES SMALLER THAN THE LIMIT RETURNING SQL0802N | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
SUM of a DOUBLE column might return SQL0802N if an intermediate floating point calculation returns a value that is outside the range for DOUBLE, even though a reasonable result is expected. The following example could reasonably return a SUM of 0, but instead generates an error. db2 connect to sample db2 "drop table mbj" db2 "CREATE TABLE mbj(value INTEGER,number DOUBLE)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, -1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 3.98000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "INSERT INTO mbj VALUES (1, 1.99000000000000E-300)" db2 "SELECT SUM(number) FROM mbj" Since the sum of the negative rows appears to be equivalent to the sum of the positive rows, a result of zero would be expected. >db2 "SELECT SUM(number) FROM mbj" 1 ------------------------ SQL0802N Arithmetic overflow or other arithmetic exception occurred. SQLSTATE=22003 This error might not occur with similar examples against other database Servers. This behavior is working as designed since double is not a precise data type, but we will accommodate requirements from applications like SAP and return 0 instead of SQL0802N in this scenario when SAP is used. Workaround: Cast column to DECFLOAT or DECIMAL: db2 "select SUM( DECFLOAT(number)) from mbj" or Use DECFLOAT or DECIMAL data type instead. | |
Problem-Zusammenfassung: | |
**************************************************************** * USERS AFFECTED: * * All Platforms * **************************************************************** * PROBLEM DESCRIPTION: * * SUM DOUBLE COLUMN WITH VALUES THAT ARE CLOSE TO ZERO MAY * * RESULT * * IN INTERMEDIATE VALUES SMALLER THAN THE LIMIT RETURNING * * SQL0802N * **************************************************************** * RECOMMENDATION: * * Upgrade to v9.7 Fixpack 4 or higher. * **************************************************************** | |
Local-Fix: | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows | |
Lösung | |
First fixed in DB2 v9.7 Fixpack 4 or higher. | |
Workaround | |
keiner bekannt / siehe Local-Fix | |
Bug-Verfolgung | |
Vorgänger : APAR is sysrouted TO one or more of the following: IC70675 Nachfolger : | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 11.08.2010 09.05.2011 09.05.2011 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.7.FP4 | |
Problem behoben lt. FixList in der Version | |
9.7.0.4 |