0

I am trying to expand my knowledge with MYsql and every time I run this via workbench, I get an syntax error but I can not seem to find it. I have been looking all over google for help with this and I did copy 2 tutorials to get to this stage.

DELIMITER $$
CREATE EVENT[IF NOT EXIST]`warning_reset` 
ON SCHEDULE EVERY 1 WEEK
STARTS '2017-03-06 18:00:00'
  ON COMPLETION PRESERVE
DO BEGIN
    call warning_script;
END */$$
DELIMITER ;

Error Below:

Error Code: 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 7

1
  • 1
    Even if you think it's not relevant to your problem, could you please edit the question and share the full actual error message? Thank you. Commented Mar 6, 2017 at 15:56

1 Answer 1

1

The event creation syntax is, to put it politely, gnarly.

Here's a rewrite of your code that works.

DELIMITER $$
CREATE EVENT  `warning_reset` 
    ON SCHEDULE EVERY 1 WEEK
    STARTS '2017-03-06 18:00:00'
    ON COMPLETION PRESERVE
DO BEGIN
    call something_or_other;
END $$
DELIMITER ;

It's best to drop and recreate events rather than use IF NOT EXISTS. If you do use IF NOT EXISTS don't use square brackets.

For some reason you had */ in your code. That's a close-comment tag. I took it out.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, and the tutorial I used, it had it like that so it might have been an error on their be-half.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.