sql >> Base de Datos >  >> RDS >> Mysql

Definición de disparador de MySQL:error 1064

Debe declarar su variable "msg" dentro de su procedimiento y usar END IF

#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