简体   繁体   English

mysql创建触发器错误代码1064 SQL语法

[英]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. 我的模式是中量级(mname,mwins,mloss,mdraws,mweight,mcountry,mage,mheight),我完全迷失了,似乎找不到问题。

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 ';' 您应该在'delimiter'关键字与其值'//'';'之间保持space ';'
Unless which it is a 1064 syntax error . 除非是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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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