这里的某处应该是语法错误,但我真的找不到一个:
DELIMITER |
CREATE TRIGGER Mieter_bi BEFORE INSERT ON Mieter FOR EACH ROW
BEGIN
IF NEW.vorname = '' AND NEW.nachname = '' AND NEW.email = '' AND NEW.mieterID > 0
THEN DELETE NEW;
END IF;
END|
错误讯息:
#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 '; END IF; END|' at line 4
感谢您的帮助;)
答案 0 :(得分:1)
这是取消插入的方法
DELIMITER |
CREATE TRIGGER Mieter_bi BEFORE INSERT ON Mieter FOR EACH ROW
BEGIN
IF NEW.vorname = '' AND NEW.nachname = '' AND NEW.email = '' AND NEW.mieterID > 0
THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Any Message';
END IF;
END|