DB2 - Problem description
| Problem IT04653 | Status: Closed |
DB2 MAY RETURN SQL0901N WHEN EXECUTING QUERY CONTAINING AN EXISTENTIAL SUBQUERY WITH A UNION OPERATOR | |
| product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
| Problem description: | |
This problem may be found in a SQL statement if following
conditions are true:
1. The query has one or more existential subquery like IN and
EXISTS
2. One or more of the subqueries contain a UNION operator
3. The outer reference to the subquery is either a base table or
a subselect joined to another base table on the same join
columns.
4. the UNION operator is below the CTQ (i.e. performed in CDE)
Example:
SELECT (C.C5 || ' ' || C.C6) AS C9, C.C4 FROM S1.T1
A,S1.T2 B, S1.T3 C WHERE A.C1 = B.C1 AND C7 = C.C4 AND C8 = 15
AND A.C1
IN (
SELECT C1
FROM S1.T1
WHERE C2 = ? AND C3 = 1
UNION OPERATOR
SELECT B.C1
FROM S1.T1 A , S1.T1 B
WHERE
A.C2 = ? AND
A.C3 = 1 AND
B.C10 = A.C1 AND
B.C3 = 2
)
Error message detail:
SQL0901N The SQL statement or command failed because of a
database system
error. (Reason "Don't know how to handle this QNC".)
SQLSTATE=58004
Some of the known stack traces are the following:
sqlnn_cmpl
sqlng_main
sqlng_main
sqlng_build_thread
sqlngProcessLolepop
sqlng_process_return_op
sqlngProcessLolepop
sqlng_process_pipe_op
sqlngProcessLolepop
sqlng_process_mate_op
sqlngProcessLolepop
sqlng_scan_derived_table
sqlng_build_thread
sqlngProcessLolepop
sqlng_process_sort_op
sqlngProcessLolepop
sqlng_process_ship_op
sqlng_build_RQOB_obj
sqldDumpContext
sqlrr_dump_ffdc
sqlzeSqlCode
sqlng_build_RQOB_obj
sqlng_process_ship_op
sqlngProcessLolepop
sqlng_process_sort_op
sqlngProcessLolepop
sqlng_build_thread
sqlng_scan_derived_table
sqlng_process_scan_op
sqlngProcessLolepop
sqlng_process_mate_op
sqlngProcessLolepop
sqlng_process_pipe_op
sqlngProcessLolepop
sqlng_process_return_op
sqlngProcessLolepop
sqlng_build_thread
sqlng_mainP9sqlnq_qur
sqlnn_cmplP8sqeAgent
sqlra_compile_var | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * Users running DB2 up to 10.5 Fix Pack 7 * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 10.5 Fix Pack 7 or later * **************************************************************** | |
| Local Fix: | |
Rewrite the subquery into an inner join with a SEL distinct on the subquery | |
| Solution | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 29.09.2014 03.02.2016 03.02.2016 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 10.5.0.7 |
|