MySQL Forums
Forum List  »  MySQL Workbench

Re: Error Code 2014 Commands out of sync; (MySQL WorkBench)
Posted by: Peter Brawley
Date: May 20, 2021 06:59PM

Three problems ...

DELIMITER $$
DROP TRIGGER IF EXISTS Before_Salary_Table_Delete; -- MOVE THIS LINE TO BEFORE THE DELIMITER DIRECTIVE 
CREATE TRIGGER Before_Salary_Table_Delete
BEFORE DELETE ON salaries FOR EACH ROW             -- DO NOT TERMNATE THIS LINE WITH A SEMICOLON
BEGIN
  SET @message = ‘This record was deleted’;        -- STRING HAS NON-ASCII CHARS THAT CONFUSE MYSQL
                                                   -- RETYPE THE LINE
  INSERT INTO SalaryLogAudit2( employeeNumber, validFrom, amount, ActionTaken )
  VALUES(OLD.employeeNumber,OLD.validFrom,OLD.amount,OLD.ActionTaken);
  UPDATE SalaryLogAudit2 
  SET ActionTaken = @message 
  WHERE employeenumber = OLD.employeeNumber;
END;
$$
DELIMITER ;

About the non-ascii chars, did you wrote this code WinWord or something like that? Don't do that.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error Code 2014 Commands out of sync; (MySQL WorkBench)
54
May 20, 2021 06:59PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.