ITeye博客

存储过程更新表

freeman983 · 2009-12-07 14:25 · Markdown

declare
  i integer;
begin
  i := 0;
  for rr in (select rowid from salebilltable where usercode is null) loop
    i := i + 1;
    update salebilltable
       set usercode = substr(userid, 1, 6)
     where rowid = rr.rowid;
    commit;
    if (mod(i, 10000) = 0) then
      dbms_output.put_line('update ' || i || 'rows');
    end if;
  
  end loop;
  dbms_output.put_line('update ' || i || ' rows');
  dbms_output.put_line('Done Successfully!');

exception
  when others then
    rollback;
    dbms_output.put_line(sqlcode);
end;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。