我想在MySql 5.1.41中執行觸發器語句,但我得到的錯誤超出了我的理解範圍。任何幫助將不勝感激。MySql觸發器語法錯誤1064空單引號
以下是觸發代碼:
create TRIGGER populate_modality_trigger AFTER INSERT on series
FOR EACH ROW BEGIN
DECLARE x int;
select count(*) into x from lu_modality_alias l WHERE l.modality=NEW.modality;
IF (x =0 OR x is NULL) THEN
INSERT INTO lu_modality_alias
set modality = NEW.modality,
modality_alias = NEW.modality
;
END if;
end;
當我上面的代碼運行,我得到以下錯誤:
MySQL said: Documentation #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 3
有趣的是,當我從Naviacat查詢編輯器中執行相同的代碼,它會成功運行並創建觸發器。 但是,從phpMyAdmin的SQL同樣失敗。
您需要更改您的分隔符解析CREATE語句。首先 ;正在結束CREATE語句 –
非常感謝,解決了問題 –