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
| CREATE OR REPLACE TRIGGER "TRG_ANNEE_I" BEFORE
UPDATE
OF "ANNEE_I", "MNT", "ag" ON "AG_ANNEE_I" FOR EACH ROW
DECLARE
nT1 ag_ex_t.NUM_T%type;
nT2 ag_ex_t.NUM_T%type;
Im ag_annee_i.Ip%type;
BEGIN
--
Select mnt into Im
From Ag_annee_i
Where Annee_i=(:NEW.ANNEE_I - 1)
And ag=:NEW.AG
And rownum=1;
SELECT num_t INTO nT2
FROM tr_i
WHERE Im between MNT1 and MNT2
AND ex = (:NEW.ANNEE_I + 1)
and rownum=1;
SELECT num_t INTO nT2
FROM tr_i
WHERE Im between MNT1 and MNT2
AND ex = (:NEW.ANNEE_I + 2)
and rownum=1;
update ag_ex_t
set num_t=nT1,num_t2=nT2
where ex=:new.annee_i+2
and agent=:new.ag;
end; |