
alter table contas disable all triggers;
declare
 v_aux number := 0;
begin
  for it in (select id,
                    c.banco_cheque,
                    c.agencia,
                    c.conta,
                    c.campoc2
               from contas_log_aux c
              group by id,
                       c.banco_cheque,
                       c.agencia,
                       c.conta,
                       c.campoc2) loop
                       
      update contas set banco_cheque = it.banco_cheque,
                        agencia = it.agencia,
                        conta = it.conta,
                        campoc2 = it.campoc2
      where id = it.id;                  
      v_aux := v_aux +1;
end loop;
dbms_output.put_line('total updates: '||v_aux);
end;
/

alter table contas enable all triggers;
