Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Triggers in MySQL example

delimiter //
CREATE TRIGGER person_bu BEFORE UPDATE
ON person
FOR EACH ROW
IF NEW.age < 18 THEN
SIGNAL SQLSTATE '50002' SET MESSAGE_TEXT = 'Person must be older than 18.';
END IF; //
delimiter ;
Source by phoenixnap.com #
 
PREVIOUS NEXT
Tagged: #Triggers #MySQL
ADD COMMENT
Topic
Name
4+7 =