我是我的 sql 的初学者,我遇到了一个错误
#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 '@nissue INT DEFAULT 0; 附近使用的正确语法;set @nissue := (set issue_id from Codes where code' at line 5
对于代码
DELIMITER $$
CREATE TRIGGER ai_SMS
AFTER INSERT ON SMS
FOR EACH ROW
BEGIN
DECLARE @nissue INT DEFAULT 0;
set @nissue := (set issue_id from Codes where code=NEW.msgbody);
IF ( EXISTS(SELECT * FROM SMS_fltr AS s INNER JOIN Persons AS p ON s.sender=p.mobile_number WHERE s.numissue=@nissue and s.sender=NEW.sender))
THEN
UPDATE SMS_fltr set time=NEW.time ,code=NEW.msgbody where numissue=@nissue and sender=NEW.sender;
ELSE
INSERT into SMS_fltr (sender,time,code,numissue) VAUES (NEW.sender,NEW.time,NEW.code,nissue);
END IF
END$$
DELIMITER ;
我正在尝试为表创建触发器。
任何人都可以告诉我犯了什么错误以及解决方案是什么?