0

I have this trigger:

DELIMITER @@

CREATE TRIGGER Test_Insert1
AFTER INSERT ON sat_clientLocation
FOR EACH ROW 
BEGIN

INSERT INTO syncLoc VALUES (NEW.idOwnApp, NEW.idClient,NEW.idLocation,NEW.idMatca,NEW.numbers,NEW.idTypeLocation,NEW.txLocation,NEW.amLat,NEW.amLong,NEW.idUpdUser,NEW.tmUpdate,NEW.txLocationDtl, NEW.idUser ,NEW.idCustomer ,NEW.idCodeLocation , NEW.radius, NEW.zindex, NEW.amAuxLat, NEW.amAuxLong, NEW.isDelete,0,0);

END;
@@
DELIMITER ;

It works fine for one insert statement, but for import from a file no. I mention that the import file is insert the statements one by one, no from load data.

Thank a lot!

  • What does your import file look like and how are you importing. – P.Salmon Mar 22 '18 at 13:10
  • 1
    MySQL triggers activate only for changes made to tables by SQL statements. This includes changes to base tables that underlie updatable views. Triggers do not activate for changes to tables made by APIs that do not transmit SQL statements to the MySQL Server. This means that triggers are not activated by updates made using the NDB API. https://dev.mysql.com/doc/refman/5.7/en/triggers.html – P.Salmon Mar 22 '18 at 13:13
  • For example now i made an import of 18 statements, and my triggers works for last 12 statements, but not for first 6. – Isabella Popa Mar 22 '18 at 13:30
  • Are the 6 inserted to sat_clientLocation ? is there any chance they fail INSERT INTO syncLoc, I would add a debug_table to the trigger to capture every for each row to see if the trigger fires for each row. – P.Salmon Mar 22 '18 at 13:34
  • All 18 are inserted in sat_clientLocation, but in syncLoc are only last 12 statements. – Isabella Popa Mar 22 '18 at 13:35
  • Then I suggest you add the debug_table and/or examine the data very carefully to see that it is compatible with syncLoc and that duplicate key errors are not firing, – P.Salmon Mar 22 '18 at 13:37
  • Understand. I will try. Thanks! – Isabella Popa Mar 22 '18 at 13:38
  • No error, and my debug_table capture de statements who is inserted in syncLoc. – Isabella Popa Mar 22 '18 at 14:15
  • If all 18 records are captured in the debug_table and no errors are reported then the conclusion no matter how unlikely it iseems is that the inserts to syncloc are happening but without the data and the table definitions I cannot do much more. – P.Salmon Mar 22 '18 at 14:32
  • The problem is not the trigger don't see the data, i make this: – Isabella Popa Mar 23 '18 at 09:57
  • The problem is not the trigger don't see the data, i make this: Trigger: Test_Insert Event: INSERT Table: sat_clientLocation Statement: BEGIN INSERT INTO debug(proc_id, debug_output) VALUES ('DEBUG','triggerTest'); END Timing: AFTER Created: NULL sql_mode: Definer: stdba@localhost character_set_client: utf8 collation_connection: utf8_general_ci Database Collation: latin1_swedish_ci and the debug table is empty. – Isabella Popa Mar 23 '18 at 09:58

0 Answers0