Created
October 14, 2014 12:50
-
-
Save uilian/645f35a4831f6cbb2ded to your computer and use it in GitHub Desktop.
SQL - Loop block update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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