SHARE
TWEET

Untitled

a guest May 16th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DELIMITER $$
  2. CREATE TRIGGER before_insert
  3. BEFORE INSERT ON reservatie
  4. FOR EACH ROW
  5. BEGIN
  6. DECLARE nmbr INT DEFAULT 0;
  7. SELECT max_aantal_gasten
  8. FROM accomodatie
  9. WHERE accomodatie.accomodatiecode = new.accomodatiecode INTO nmbr;
  10.  
  11. IF (new.aantalgasten > nmbr)
  12. THEN
  13. SIGNAL SQLSTATE '45000'
  14. SET MESSAGE_TEXT = 'ERROR te veel mensen',
  15. TABLE_NAME = 'reservatie',
  16. COLUMN_NAME='aantalgasten',
  17. MYSQL_ERRNO = 9005;
  18. END IF;
  19.  
  20. END $$
  21. DELIMITER :
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top