创建触发器时,我在Mysql 5中遇到错误#1064

时间:2015-10-28 03:00:14

标签: mysql

错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6 

我的触发

CREATE TRIGGER `register_notification_after_register`
`AFTER INSERT ON register FOR EACH ROW BEGIN
Set @notification = CONCAT('New Member Register. Membership Code is',' ',new.membership_no,'.');
Set @notificationfor =CONCAT('New Membership');
call notification_masterAddUpdate(1,@notification,@notificationfor,new.reg_date,1); 
END

1 个答案:

答案 0 :(得分:2)

试试这个:

DELIMITER $$
CREATE TRIGGER `register_notification_after_register`
AFTER INSERT ON register FOR EACH ROW BEGIN
Set @notification = CONCAT('New Member Register. Membership Code is',' ',new.membership_no,'.');
Set @notificationfor =CONCAT('New Membership');
call notification_masterAddUpdate(1,@notification,@notificationfor,new.reg_date,1); 
END
$$ -- I am done server, end of block
DELIMITER ;
你在第二行有额外的反击。需要设置DELIMITER来阻止整个事情。使用create event,创建存储过程,创建触发器,分隔符可以在整个块完成时将服务器引入。请记住;结束语句。分隔符语句暂停它以支持其他内容,然后在块结束时重置

相关问题