Hi
The code shown in the CREATE code tab doesn't contain a delimiter, so
a complex statement inside a BEGIN..END block fails with a syntax error [SQL Error (1064)].
Example of the created code:
CREATE DEFINER=`root`@`%` TRIGGER `example_trigger` BEFORE INSERT ON `example_table` FOR EACH ROW BEGIN
INSERT INTO foo (test1, test2) VALUES ('bar', example_attribute.NEW);
END
In order to work correctly in such a case, a delimiter must be defined.
See https://dev.mysql.com/doc/refman/5.5/en/trigger-syntax.html for a more detailed description.
Example of the code with delimiter:
DELIMITER //
CREATE DEFINER=`root`@`%` TRIGGER `example_trigger` BEFORE INSERT ON `example_table` FOR EACH ROW BEGIN
INSERT INTO foo (test1, test2) VALUES ('bar', example_attribute.NEW);
END;//
DELIMITER ;
Heidisql: 9.3.0.5004
Please add Delimiters in mySQL trigger create code
Please login to leave a reply, or register at first.