Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't create after update trigger #668

Closed
balexandre opened this issue Jun 4, 2019 · 1 comment
Closed

can't create after update trigger #668

balexandre opened this issue Jun 4, 2019 · 1 comment

Comments

@balexandre
Copy link

Steps to reproduce this issue

tries to create an after-update trigger

CREATE after_campaign_update` AFTER UPDATE ON `campaigns` FOR EACH ROW BEGIN
    UPDATE `sc-campaigns`.campaigns SET 
  `client_id` = NEW.client_id,
  `guid` = NEW.guid,
  `name` = NEW.name,
  `description` = NEW.description,
  `active` = NEW.active,
  `settings` = NEW.settings
  WHERE id = OLD.id;
END

Current behavior

HeidiSQL return this

CREATE DEFINER=`sc_root`@`%` TRIGGER `after_campaign_update` AFTER UPDATE ON `campaigns` FOR EACH ROW BEGIN
    UPDATE `sc-campaigns`.campaigns SET 
  `client_id` = NEW.client_id,
  `guid` = NEW.guid,
  `name` = NEW.name,
  `description` = NEW.description,
  `active` = NEW.active,
  `settings` = NEW.settings
  WHERE id = OLD.id;
/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9 */
/* Affected rows: 0  Found rows: 0  Warnings: 0  Duration for 0 of 2 queries: 0,000 sec. */

Line 9 is the line where you find WHERE id = OLD.id;

Expected behavior

I would expect to create the trigger, as it did with other SQL UI (tablePlus on Mac)

Possible solution

Out of my scope

Environment

  • HeidiSQL version: 10.1.0.5464 (64 Bit)
  • Database system and version: 10.1.34-MariaDB
  • Operating system: Windows v10.0
@ansgarbecker
Copy link
Collaborator

If you run such compound statements, you need to set the delimiter to something else than semicolon, otherwise HeidiSQL splits your statement at each semicolon.

You can tell HeidiSQL to use e.g. \\ as delimiter, by pressing the button with the semicolon on the maintoolbar. Or use the DELIMITER client command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants