Hello,
DB2 v8 FP15 luw.
Serge=B4s SQL on Fire has the following code for granular commits on
delete statements:
loop: LOOP
DELETE FROM (SELECT 1 FROM T WHERE ID =3D ? FETCH FIRST 1000 ROWS
ONLY) AS D;
IF SQLCODE =3D 100 THEN LEAVE loop;
END IF;
COMMIT;
END LOOP loop;
I want to achieve the same for Update statements on multi million
tables. My first try is:
loop: LOOP
update from T where ID IN
(
select ID from
(select ID, rownumber() over (partition by ID order by ID desc) as
RN from T where ID =3D ? ) as x
where rn <=3D 1000
)
IF SQLCODE =3D 100 THEN LEAVE loop;
END IF;
COMMIT;
END LOOP loop;
Any better suggestion or approach ?
Thanks, Michel