DB2 - Problem description
Problem IT22221 | Status: Closed |
WRONG RESULTS OR SQL901N MAY OCCUR WHEN EXECUTING A SQL STATEMENT CONTAINING TWO OR MORE NOT IN OR NOT EXISTS PREDICATES | |
product: | |
DB2 FOR LUW / DB2FORLUW / B10 - DB2 | |
Problem description: | |
You might encounter wrong results or SQL901N errors when executing a SQL statement containing two or more NOT IN (or NOT EXISTS) predicates under the following conditions, where PRD_NOTIN_A and PRD_NOTIN_B are two eligible NOT IN predicates: 1. The columns on the left hand side of PRD_NOTIN_A and PRD_NOTIN_B are from different tables; 2. The table containing the column on the left hand side of PRD_NOTIN_A also contains column(s) used in another predicate (Let's call it PRD_NON_NOT_IN); 3. PRD_NON_NOT_IN has a sub-query that contains a correlated column with the column on the left hand side of PRD_NOTIN_B. Here is an example of a failing query: SELECT a1 FROM a WHERE a.a2 NOT IN (SELECT b1 FROM b) //PRD_NOTIN_B AND EXISTS (SELECT c1 FROM c WHERE c.c1 = (SELECT d1 FROM d WHERE d.d2 = a.a1) //PRD_NON_NOT_IN AND c.c1 NOT IN (SELECT e1 FROM e)); //PRD_NOTIN_A | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Please, See Error Description and install this fix. * **************************************************************** | |
Local Fix: | |
When encountering this problem, you can apply the following registry setting using an optimization guideline on the affected queries as a workaround: <query> /* <OPTGUIDELINES> <REGISTRY><OPTION NAME='DB2_ANTIJOIN' VALUE='NO'/> </REGISTRY> </OPTGUIDELINES> */; | |
available fix packs: | |
Db2 Version 11.1 Mod 3 Fix Pack 3 for Linux, UNIX, and Windows | |
Solution | |
Please, See Error Description and install this fix. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 31.08.2017 16.03.2018 16.03.2018 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) |