1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
declare
cursor c1 is
select acc_hd_id, tr_date
from acc_hd
where bra = '02'
and trdate between add_months(to_date('01/01/2007','dd/mm/yyyy'),i) and last_day(add_months(to_date('01/01/2007','dd/mm/yyyy'),i))
order by trdate, acc_hd_id;
c11 c1%rowtype;
x number;
i number;
begin
i := 0;
x := 0;
open c1;
loop
fetch c1 into c11;
exit when c1%notfound;
x := x + 1;
begin
update acc_hd
set no_hd_id = x
where acc_hd_id = c11.acc_hd_id;
end;
begin
update acc
set no_id = x
where acc_id = c11.acc_hd_id;
end;
i := i+1;
end loop;
close c1;
end;
/ |
Partager