Thursday, January 7, 2010

Error Code : 1235 This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'

First i made a Trigger like this..(To make an update of summary numeric field if any insert happen in one table)

DELIMITER $$

CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `update_jum_proposal` AFTER INSERT ON `tb_proposal`
FOR EACH ROW BEGIN
DECLARE NEW_VALUE int;
SELECT count(id) INTO NEW_VALUE FROM tb_proposal where tahun = new.tahun;

update tb_dwh_pengabdian set pengabdian_jum_proposal = NEW_VALUE where pengabdian_tahun=new.tahun;
END;
$$

DELIMITER ;


and then an error occured :
Error Code : 1235
This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
(0 ms taken)


How this can be solved : Just add an Drop Trigger Statement


DELIMITER $$

DROP TRIGGER /*!50032 IF EXISTS */ `db_pengabdian`.`update_jum_proposal`$$

CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `update_jum_proposal` AFTER INSERT ON `tb_proposal`
FOR EACH ROW BEGIN
DECLARE NEW_VALUE int;
SELECT count(id) INTO NEW_VALUE FROM tb_proposal where tahun = new.tahun;

update tb_dwh_pengabdian set pengabdian_jum_proposal = NEW_VALUE where pengabdian_tahun=new.tahun;
END;
$$

DELIMITER ;



I Found this at http://forums.mysql.com/read.php?99,161909,162074#msg-162074.

Hope this help anyone...

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Sweet Tomatoes Printable Coupons