Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. create or replace TRIGGER CHEQUEVALIDE_ANNULE
  2. BEFORE UPDATE OF ETATCHCODE ON CHEQUE
  3. REFERENCING OLD AS A NEW AS N
  4. FOR EACH ROW
  5. DECLARE
  6. v_opmontant number;
  7. v_cptnum number;
  8. BEGIN
  9. IF :a.etatchcode = 2 and :n.etatchcode=1 then
  10. --le cheque est traité
  11. update operation set etatopcode=1 where opnum =:n.opnum ;
  12. elsif :a.etatchcode = 2 and :n.etatchcode=4 then
  13. --le cheque est refusé
  14. update operation set etatopcode=3 where opnum = :n.opnum;
  15. select cptnum,opmontant into v_cptnum, v_opmontant from operation where opnum=:n.opnum ;
  16. update compte set cptbalance=cptbalance -v_opmontant where cptnum=v_cptnum;
  17. end if;
  18. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement