在我看来,

但是当我运行它时,MySQL说。


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


这是我第一次使用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;

最佳答案

请从DELIMITER;更改为DELIMITER ;

关于mysql - 我的触发器查询中的MySQL Delimiter错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31539612/

10-16 07:43