0

我在 MySqldealersdealers_info. 我尝试创建触发器,删除信息dealers后将删除相应的行dealers info

CREATE TRIGGER del_info AFTER DELETE ON  dealers
FOR EACH ROW 
BEGIN
DELETE FROM dealers_info WHERE dealer_id = OLD.dealer_id;
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 '' at line 4 
4

1 回答 1

1

更改分隔符以正确执行查询,

DELIMITER $$
CREATE TRIGGER del_info 
AFTER DELETE ON  dealers
FOR EACH ROW 
BEGIN
    DELETE FROM dealers_info WHERE dealer_id = OLD.dealer_id;
END $$
DELIMITER ;
于 2013-03-01T07:20:24.727 回答