简体   繁体   中英

mysql creating trigger error code 1064 SQL syntax

my schema is middleweight(mname, mwins, mlosses, mdraws, mweight, mcountry, mage, mheight) I am completely lost cant seem to find the problem.

delimiter//
CREATE TRIGGER tr_middlewegiht_u
BEFORE update on middleweight
for each row
begin
          IF (new.mweight>185) THEN
             SIGNAL sqlstate '45000'
                  set message_text = 'The fighters in the wrong weight class.';
               END if;
END//
delimiter;

You should maintain a space between 'delimiter' key word and its values '//' , and ';'
Unless which it is a 1064 syntax error .

Example :

delimiter // -- <--- observe the space here. It is a MUST

-- your trigger definition

end;

//

delimiter ; -- <--- maintain space here too. This too is a MUST

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM