DB2 - Problem description
Problem IC63329 | Status: Closed |
Two or more outer joins containing f(NULL) that returns non-null value may return incorrect results | |
product: | |
DB2 FOR LUW / DB2FORLUW / 910 - DB2 | |
Problem description: | |
SQL statement that contains two or more outer joins with the predicate of the first ON clause containing expressions that could change the null value of the left side of the LEFT outer join to a non-null value may return incorrect results. Example: WITH A(A1) as (values 1), B(B1) as (values cast(NULL as INTEGER)), C(C1) as (values 1) SELECT A1,B1,C1 FROM A LEFT JOIN (B LEFT JOIN C ON COALESCE(B1,1)=C1) ON A1=B1; The above statement hits this APAR because 1. There are two outer joins. 2. The expression in the first ON clause, COALESCE(B1,1)=C1 could change the value of NULL of B1 to a non-null value. The correct result for the above statement is A1 B1 C1 ----------- ----------- ----------- 1 - - An example of a SQL statement that does NOT hit this APAR is WITH A(A1) as (values 1), B(B1) as (values cast(NULL as INTEGER)), C(C1) as (values 1) SELECT A1,B1,C1 FROM A LEFT JOIN (B LEFT JOIN C ON COALESCE(B1,1)=C1) AND B1=C1 ON A1=B1; Even though, the COALESCE expression exists, the addition expression B1=C1, which return NULL if B1 is NULL, will safe guard this statement to not return incorrect results. | |
Problem Summary: | |
USERS AFFECTED All PROBLEM DESCRIPTION see ERROR DESCRIPTION PROBLEM SUMMARY see ERROR DESCRIPTION | |
Local Fix: | |
available fix packs: | |
DB2 Version 9.1 Fix Pack 9 for Linux, UNIX and Windows | |
Solution | |
The complete fix for this problem first appears in DB2 UDB Version 9.1 FixPak 9. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 22.09.2009 14.04.2010 14.04.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.0., 9.1. | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.1.0.9 |