Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace TRIGGER Populate_specialite
- AFTER UPDATE OR INSERT OR DELETE ON professeurs
- FOR EACH ROW
- BEGIN
- IF inserting THEN
- UPDATE prof_specialite SET nb_professeurs = nb_professeurs + 1 WHERE specialite = :NEW.specialite;
- END IF;
- IF deleting THEN
- UPDATE prof_specialite SET nb_professeurs = nb_professeurs - 1 WHERE specialite = :NEW.specialite;
- END IF;
- IF updating THEN
- UPDATE prof_specialite SET nb_professeurs = nb_professeurs + 1 WHERE specialite = :NEW.specialite;
- UPDATE prof_specialite SET nb_professeurs = nb_professeurs - 1 WHERE specialite = :OLD.specialite;
- END IF;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement