home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC96330 Status: Closed

SQL0901N REASON "COLUMN NUMBER OUT OF RANGE" WHEN SELECTING FROM
TABLES RELATED VIA FOREIGN KEY, AFTER ALTER DROP COLUMN

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
When two tables have the same Foreign key name to refer to each 
other on different parent - dependent relationships, if a column 
(not related to the foreign key columns) is dropped from one of 
the tables, queries or joins that involve those tables might 
fail with SQL0901N REASON "COLUMN NUMBER OUT OF RANGE". 
 
The following example shows this behaviour: 
 
create table t1 (c1 int not null ,c2 int, c3 int,constraint PKt1 
primary key (c1)); 
create table t2 (c1 int not null,c2 int,c3 int,c4 int,constraint 
PKt2 primary key (c1)); 
 
alter table t2 add constraint FK2 foreign key(c4) references t1; 
alter table t1 add constraint FK2 foreign key(c3) references t2; 
 
Note that both tables refer to each other with the same Foreign 
Key name : FK2. 
 
 
db2 alter table t2 drop column c3; 
 
db2 "select * from t1,t2 where t1.c1=t1.c3" 
SQL0901N  The SQL statement failed because of a non-severe 
system error. 
Subsequent SQL statements can be processed.  (Reason "column 
number out of 
range".)  SQLSTATE=58004
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 Cancun Release 10.5.0.4 (also known as Fix    * 
* Pack 4) or higher                                            * 
****************************************************************
Local Fix:
Make sure that there are no duplicate Foreign key names between 
a pair of tables. 
Drop and recreate the foreign keys with different names in 
between the pair of tables: 
 
alter table t2 drop foreign key FK2; 
alter table t1 drop foreign key FK2; 
alter table t2 add constraint FK21 foreign key(c4) references 
t1; 
alter table t1 add constraint FK12 foreign key(c3) references 
t2;
available fix packs:
DB2 Cancun Release 10.5.0.4 (also known as Fix Pack 4) for Linux, UNIX, and Windows
DB2 Version 10.5 Fix Pack 9 for Linux, UNIX, and Windows

Solution
Problem was first Fixed in DB2 Cancun Release 10.5.0.4 (also 
known as Fix Pack 4)
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
26.09.2013
08.09.2014
17.10.2014
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.5.0.4 FixList