Add a counter

Code:
counter := 0

insert ...
counter := counter + 1
if counter = 1000 then
  commit;
  counter := 0;
end if;