suche 36x36
Neueste VersionenFixList
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
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IT27712 Status: Geschlossen

MERGE STATEMENT WITH DISTINCT CAN INCORRECTLY UPDATE MULTIPLE TARGET ROWS

Produkt:
DB2 FOR LUW / DB2FORLUW / B10 - DB2
Problembeschreibung:
Data corruption is possible with MERGE statement using DISTINCT.
Statement should have returned SQL0788N.

Example:

create table S (C1 smallint, C2 varchar(10) );
create table T (C1 smallint, C2 varchar(10) );

insert into S values (1, 'A');
insert into S values (2, 'B');
insert into S values (3, 'C');
insert into S values (3, 'C2');
insert into S values (4, 'D');

insert into T values (1, 'A');
insert into T values (2, 'B');
insert into T values (3, 'C');
insert into T values (4, 'D');

db2 => merge into T using (select distinct c1, c2 from S) S
on T.C1 = S.C1
when matched then update set T.C2 = T.C2 || '-' || S.C2
DB20000I  The SQL command completed successfully.

Both target rows with C1=3 are updated.
The above statement should get error -788.

db2 => select * from T;

C1     C2
------ ----------
     1 A-A
     2 B-B
     3 C-C2
     4 D-D

  4 record(s) selected.
Problem-Zusammenfassung:
****************************************************************
* USERS AFFECTED:                                              *
* ALL                                                          *
****************************************************************
* PROBLEM DESCRIPTION:                                         *
* See Error Description                                        *
****************************************************************
* RECOMMENDATION:                                              *
* Upgrade to Db2 11.1 Mod 4 Fixpack 4 iFix 001 or higher       *
****************************************************************
Local-Fix:
If the DISTINCT clause is not strictly necessary, remove it.
Otherwise, ensure that each column in the source table-reference
is also included in the MERGE search condition, e.g. for the
example above, add predicate T.C2=S.C2:

merge into T using (select distinct c1, c2 from S) S
on T.C1 = S.C1 and T.C2 = S.C2
when matched then update set T.C2 = T.C2 || '-' || S.C2;
Lösung
Workaround
keiner bekannt / siehe Local-Fix
Bug-Verfolgung
Vorgänger  : IT27705 
Nachfolger : 
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
10.01.2019
07.03.2019
08.03.2019
Problem behoben ab folgender Versionen (IBM BugInfos)
Problem behoben lt. FixList in der Version