Mysql
 sql >> Datenbank >  >> RDS >> Mysql

MySQL-Trigger-Definition – 1064-Fehler

Sie müssen Ihre Variable "msg" in Ihrer Prozedur deklarieren und END IF

verwenden
#START TRIGGER
delimiter //
CREATE TRIGGER passStandard_check BEFORE INSERT ON Module
FOR EACH ROW 
BEGIN 
    DECLARE msg VARCHAR(255); /* << PUT THIS HERE */
    IF NEW.passStandard < 0 || NEW.passStandard > 1 THEN 
        set msg = concat('Trigger Error: Pass Standard: ', cast(NEW.passStandard as char));
        signal sqlstate '45000' set message_text = msg;
    END IF; /* << YOU WILL NEED THIS TOO (DONT FORGET THE SEMICOLON :D) */
END//
delimiter ;
#END TRIGGER