All,
I want to make an insert to a table based upon data in that table. Let's assume the table has 3 columns PROD_ID, PROD_TYPE and PROD_TIMESTAMP. The query I wish to run is along the following lines:
INSERT INTO TABLE_A
SELECT PROD_ID
,16 (this is the PROD_TYPE column)
,PROD_TIMESTAMP + 1 MICROSECOND
FROM TABLE_A
WHERE PROD_TYPE = 15
What I believe will happen is that DB2 will run the inner query, building an interim results table, and then perform the insert from that temporary table. In locking terms, I think that a read lock will be taken whilst the inner query is running, which is then promoted to update lock as the insert is performed.
Is anybody able to confirm whether this is correct or incorrect.
Marc
I want to make an insert to a table based upon data in that table. Let's assume the table has 3 columns PROD_ID, PROD_TYPE and PROD_TIMESTAMP. The query I wish to run is along the following lines:
INSERT INTO TABLE_A
SELECT PROD_ID
,16 (this is the PROD_TYPE column)
,PROD_TIMESTAMP + 1 MICROSECOND
FROM TABLE_A
WHERE PROD_TYPE = 15
What I believe will happen is that DB2 will run the inner query, building an interim results table, and then perform the insert from that temporary table. In locking terms, I think that a read lock will be taken whilst the inner query is running, which is then promoted to update lock as the insert is performed.
Is anybody able to confirm whether this is correct or incorrect.
Marc