Answer the question
In order to leave comments, you need to log in
Why is mysql trigger not being created?
Why the completely copied mysql trigger does not work, I have already considered it to the holes. All databases exist with such fields.
mysql>
mysql> USE statistic; CREATE TRIGGER`countryLog` AFTER INSERT ON `Country` FOR EACH ROW BEGIN INSERT INTO log(msg,row_id) values ('insert', NEW.id_country); END;
Database changed
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1
mysql>
Answer the question
In order to leave comments, you need to log in
Because here you, on the contrary , did not change the command delimiter, which is what you need to do.
Such is the stupid mysql syntax, the parser needs to be specially explained where the trigger (or stored procedure) ends.
CREATE TRIGGER `countryLog` AFTER INSERT ON `Country`
FOR EACH ROW INSERT INTO log(`msg`, `row_id`) VALUES ('insert', NEW.id_country)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question