我想打一個2-3觸發1臺。例如(這是我的查詢):創建多個觸發器爲一個表
DELIMITER $$
CREATE OR REPLACE TRIGGER IF EXISTS insert_before_update_slugrapat BEFORE UPDATE ON slugrapat
FOR EACH ROW
BEGIN
INSERT INTO record_pemakaian_slug_rapat(rc_sr_size, rc_sr_stockawal, rc_sr_holling, rc_sr_store, rc_sr_sales, rc_sr_sisa, rc_sr_lastdate)
VALUES(new.sr_size, new.sr_stockawal, new.sr_holling, new.sr_store, new.sr_sales, new.sr_sisa, new.sr_lastdate);
/
CREATE OR REPLACE TRIGGER IF EXISTS insert_before_update_slugrapat BEFORE UPDATE ON slugrapat
FOR EACH ROW
BEGIN
INSERT INTO so_slugrapat(sr_size, sr_sisa, sr_stockakhir, sr_stockopname, sr_lastdate)
VALUES(new.sr_size, new.sr_sisa, new.sr_stockakhir, new.sr_stockopname, new.sr_lastdate);
END $$
DELIMITER ;
和錯誤說:
Error code 1064, SQL state 42000: 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 'TRIGGER IF EXISTS insert_before_update_slugrapat BEFORE UPDATE ON slugrapat
FOR ' at line 1
我想已經張貼在計算器但它仍然無法正常工作許多方面。
爲什麼存根'/'那裏? – hjpotter92 2013-03-05 08:06:22
爲什麼不把所有內容合併爲一個,因爲它們出現在同一張表'BEFORE UPDATE'上? – SparKot 2013-03-05 08:13:36
錯誤..因爲我在另一篇文章中讀到,它說在同一個腳本上的兩個觸發器,我必須添加「/」來代替mysql中的「GO」。這是錯的嗎? – ShenWu 2013-03-05 08:13:44