Please add Delimiters in mySQL trigger create code

[expired user #9323]'s profile image [expired user #9323] posted 8 years ago in General Permalink
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
[expired user #9857]'s profile image [expired user #9857] posted 8 years ago Permalink

I would also like to see this added.

After adding the delimiter code I was able to push the trigger code that Heidi has generated.

Heidisql: 9.3.0.4984

Please login to leave a reply, or register at first.