我的触发器查询中的MySQL分隔符错误

时间:2015-07-21 12:55:04

标签: mysql triggers

这看起来对我来说,

但是当我运行时,MySQL说。

  

'delimiter'附近的第1行存在语法错误

这是我第一次使用MySQL。如果我做的话傻话,请告诉我。谢谢!

DELIMITER $$
DROP TRIGGER IF EXISTS TR_ARCHIVE_UNITS $$
CREATE TRIGGER TR_ARCHIVE_UNITS
BEFORE DELETE ON unit_tracking
FOR EACH ROW
BEGIN
    INSERT IGNORE INTO unit_tracking_HIST (id, dateAdded, unitCondition, make, model, unit_num, consign_flag, serial_num, description, gl_num, trade, invoice_posted, notes, deleted_date, user_deleted)
    SELECT id, dateAdded, unitCondition, make, model, unit_num, consign_flag, serial_num, description, gl_num, trade, invoice_posted, notes
    FROM unit_tracking
    WHERE id = OLD.id;
END $$
DELIMITER;

1 个答案:

答案 0 :(得分:1)

请将DELIMITER;更改为DELIMITER ;