Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. CREATE TRIGGER check_appareillage_update BEFORE UPDATE ON hospitalisation FOR EACH ROW
  2. BEGIN
  3. DECLARE appareillage_chambre TINYINT;
  4. IF NEW.appareillage = 1 THEN
  5. SET appareillage_chambre = (SELECT appareillage FROM chambre c, lit l, occupe o
  6. WHERE c.numCh = l.chambre AND l.numL = o.numL AND o.nSS = NEW.nss);
  7. IF appareillage_chambre = 0 THEN
  8. signal sqlstate '45000' set message_text = 'La chambre n est pas appareillée';
  9. end if;
  10. end if;
  11. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement