KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a simple question. Ive got a trigger to insert the values into another Database So for example if there are two values and the trigger is checking the value in Table A and inserting into Table B So here is the code -- Trigger DDL Statements USE `db`; DELIMITER // CREATE DEFINER=CURRENT_USER() TRIGGER `db`.`AFTER_INSERT_A` AFTER INSERT ON `db`.`a` FOR EACH ROW BEGIN IF NEW.val!= NULL THEN UPDATE b SET dateRemove=CURRENT_TIMESTAMP WHERE val=NEW.val; INSERT INTO b (val) VALUES(NEW.val) ON DUPLICATE KEY UPDATE dateRemove=NULL, dateUpdate=CURRENT_TIMESTAMP; END IF; END// The trigger dosent even throw any errors. And i have no values in B My Insert is INSERT INTO a (val) VALUES(`test`) ON DUPLICATE KEY UPDATE dateUpdate=CURRENT_TIMESTAMP Has any one got any ideas. Ive tried creating two triggers one INSERT and the other UPDATE , Ive changed the AFTER to BEFORE and my table b still got nothing. Any ideas thanks in advance
Tags (comma-separated)
Save Edits
Cancel