Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. create or replace TRIGGER Populate_specialite
  2. AFTER UPDATE OR INSERT OR DELETE ON professeurs
  3. FOR EACH ROW
  4.  
  5. BEGIN
  6.  
  7. IF inserting THEN
  8. UPDATE prof_specialite SET nb_professeurs = nb_professeurs + 1 WHERE specialite = :NEW.specialite;
  9. END IF;
  10. IF deleting THEN
  11. UPDATE prof_specialite SET nb_professeurs = nb_professeurs - 1 WHERE specialite = :NEW.specialite;
  12. END IF;
  13. IF updating THEN
  14. UPDATE prof_specialite SET nb_professeurs = nb_professeurs + 1 WHERE specialite = :NEW.specialite;
  15. UPDATE prof_specialite SET nb_professeurs = nb_professeurs - 1 WHERE specialite = :OLD.specialite;
  16. END IF;
  17.  
  18. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement