Skip to content

Instantly share code, notes, and snippets.

@uilian
Created October 14, 2014 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uilian/645f35a4831f6cbb2ded to your computer and use it in GitHub Desktop.
Save uilian/645f35a4831f6cbb2ded to your computer and use it in GitHub Desktop.
SQL - Loop block update
--- template, adjust accordingly
declare
cnt integer;
begin
cnt := 0;
for req in (select rowid, x, y, z from tabela where x is null) loop
update tabela set y = x+z where rowid = req.rowid;
cnt := cnt + 1;
if cnt > 5000 then
commit;
cnt := 0;
end if;
end loop;
commit;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment