MySQL Trigger corruption ?
Hi,
I'm using MySQL 5.6.10 on Wamp Server.
I've got twice time a problem this week with triggers.
I make no modification on those triggers for months. And, twice time I get triggers errors....
The triggers was "beforeinsert" triggers on 2 differents table.
The last issue was on a big table and the code of the trigger is pretty simple
TRIGGER `ant_antenne_candidat__beforeInsert` BEFORE INSERT ON `ant_antenne_candidat`
FOR EACH ROW BEGIN
## Suppression des éléments associés
IF (NEW.id_Tiers_Siret IS NULL) OR (NEW.id_Tiers_Siret <0) THEN
SET NEW.id_Tiers_Siret=(SELECT id_Tiers_Siret FROM ant_antenne WHERE id_Antenne=NEW.id_Antenne);
END IF;
So, when i would like to insert a line on ant_antenne_candidat, i get this error :
"NEW.id_Tiers_Siret doesn't exist"
Strange, huh ?
I tried to alter the trigger, i made no modification and rexecute it :
DELIMITER $$
DROP TRIGGER /*!50032 IF EXISTS */ `ant_antenne_candidat__beforeInsert`$$
CREATE
/*!50017 DEFINER = 'root'@'%' */
TRIGGER `ant_antenne_candidat__beforeInsert` BEFORE INSERT ON `ant_antenne_candidat`
FOR EACH ROW BEGIN
## Suppression des éléments associés
IF (NEW.id_Tiers_Siret IS NULL) OR (NEW.id_Tiers_Siret <0) THEN
SET NEW.id_Tiers_Siret=(SELECT id_Tiers_Siret FROM ant_antenne WHERE id_Antenne=NEW.id_Antenne);
END IF;
END;
$$
DELIMITER ;
And now, it's ok... it's like the trigger was "corrupted"...
So, what do you think about it ? It's dangerous... ? What can i do ?
Subject
Views
Written By
Posted
MySQL Trigger corruption ?
3710
June 06, 2013 07:34AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.