From the docs:
http://pic.dhe.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.admin.perf.doc/doc/c0012389.html
The DB2_SKIPINSERTED registry variable controls whether or not
uncommitted data insertions can be ignored for statements that use the
cursor stability (CS) or the read stability (RS) isolation level.
Uncommitted insertions are handled in one of two ways, depending on the
value of the DB2_SKIPINSERTED registry variable.
When the value is ON, the DB2� server ignores uncommitted insertions,
which in many cases can improve concurrency and is the preferred
behavior for most applications. Uncommitted insertions are treated as
though they had not yet occurred.
When the value is OFF (the default), the DB2 server waits until the
insert operation completes (commits or rolls back) and then processes
the data accordingly. This is appropriate in certain cases. For example:
Suppose that two applications use a table to pass data between
themselves, with the first application inserting data into the table and
the second one reading it. The data must be processed by the second
application in the order presented, such that if the next row to be read
is being inserted by the first application, the second application must
wait until the insert operation commits.
An application avoids UPDATE statements by deleting data and then
inserting a new image of the data.
So SKIPINSERTED should be off. But the semantics is different for 10.1
compared with 9.5. For 10.1 it does not help turning DB2_SKIPINSERTED=OFF
[lelle@dustbite T1]$ db2set DB2_SKIPINSERTED=OFF
[lelle@dustbite T1]$ db2stop force && db2start
SQL1064N DB2STOP processing was successful.
SQL1063N DB2START processing was successful.
[lelle@dustbite T1]$
[lelle@dustbite T1]$ db2 connect to sample
Database Connection Information
Database server = DB2/LINUXX8664 10.1.0
SQL authorization ID = LELLE
Local database alias = SAMPLE
[lelle@dustbite T1]$ db2 +c "merge into t as a using ( values (1) ) b(x)
> on a.x = b.x when not matched then insert (x) values (b.x) with rs"
DB20000I The SQL command completed successfully.
[lelle@dustbite T2]$ db2 +c "merge into t as a using ( values (1) ) b(x)
> on a.x = b.x when not matched then insert (x) values (b.x) with rs"
[lelle@dustbite T1]$ db2 commit
DB20000I The SQL command completed successfully.
[lelle@dustbite T2]$ ...
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it returned:
SQL0803N One or more values in the INSERT statement, UPDATE statement, or
foreign key update caused by a DELETE statement are not valid because the
primary key, unique constraint or unique index identified by "1" constrains
table "LELLE.T" from having duplicate values for the index key.
SQLSTATE=23505
As mentioned before, this is just observations but it would still be
interesting to find out what caused this change in behaviour between 9.5
and 10.1. Any thoughts anyone?
/Lennart