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 35
|
CREATE OR REPLACE PROCEDURE "CHGT_TR"
(
nEXERCICE in number
) is
nTr in number;
CURSOR C_AG IS
Select num, mnt, etat
From Ag
Where Ann=nExercice;
begin
For Cur in C_AG loop
if C_AG.etat = 1 THEN
Update ag_ex
set
num=0,
num2=0
where ex=nExercice
and num=C_AG.num;
else
SELECT num_tr INTO nTr1
FROM tr
WHERE mnt between inf and sup
AND ex = nExercice;
Update ag_ex
set
num=nTr,
num2=0
where ex=nExercice
and num=C_AG.num;
end if;
End loop;
end; |