按日期循环总计字段的更新存储过程

按日期循环累计字段的更新存储过程
create or replace procedure updateTotaluser as
date_id_in number;
begin
for i in (select distinct date_id as date_id_in from browser_use_os_f t where t.date_id<=20120220 order by t.date_id) LOOP
    begin
    update browser_use_os_f t
    set t.total_newuser =
         (select sum(f.newuser)
          from browser_use_os_f f
          where f.date_id <= i.date_id_in
           and t.country_id = f.country_id
           and t.platform_id = f.platform_id
           group by f.country_id,f.platform_id)  where t.date_id = i.date_id_in;
    end;
   end LOOP;
end updateTotaluser;