jeudi 8 janvier 2015

why my trigger does not work (I have two triggers referencing to the same table)?


creating triggers related to the same table, error obviously


I have the following Trigger



DROP TRIGGER IF EXISTS `test`;
CREATE TRIGGER `test`
BEFORE UPDATE ON
`traco_activities`
FOR EACH ROW INSERT INTO bitacora_tarifas(fecha)
VALUES (NOW())


but it does not work, and I got it the following error:


1442-Can´t update table 'bitacora_tarifas' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.


the structure of the table bitacora_tarifas is the next:



id, mediumint
fecha, datetime


The "id" is autoincrement i tried :


FOR EACH ROW INSERT INTO bitacora_tarifas(id,fecha) VALUES (0,NOW())


but anyways it does not work....


Someone can help me?





Aucun commentaire:

Enregistrer un commentaire