0

I am trying to define a trigger in MySQL and the language to create it never executes. I have already defined and inserted data into the database with no problem.

This is the start of my trigger. As you can see I put some giberish in there to illustrate that this never executes because it produces no errors at all.

delimiter //

snthd\-
\qeiksdhsnthd-/rcg dsth
o;eui;r/cf/r
\qk-xnthr/cf


CREATE TRIGGER deleted_insert
ON item
AFTER UPDATE,INSERT
AS 
BEGIN
        ...etc body of trigger

END;

delimiter ;

Executing this does absolutely nothing and does not return any output from the sql server. If I do not change the delimiter, then it does execute but produces a syntax error on the 'ON' keyword.

How can simply declare this trigger?

  • 1
    It looks like you're using T-SQL / Microsoft SQL Server syntax, not MySQL syntax. – AMtwo Feb 10 at 1:25
  • 1
    Doesn’t look like you’re terminating with the // delimiter you declare at the beginning. – eroomydna Feb 10 at 6:53
  • The syntax for CREATE TRIGGER in MySQL. – danblack Feb 10 at 21:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.