MYSQL事件显示错误“对不起,发生了意外错误!”

时间:2018-09-12 05:41:32

标签: mysql sql database mysql-event

我有这个MYSQL事件,我不明白为什么它不起作用。它显示给我一个错误,提示“抱歉发生了意外错误!”当我尝试执行phpmyadmin时。请有人告诉我这段代码有什么问题。

DELIMITER //
CREATE EVENT salary_add
  ON SCHEDULE EVERY 24 HOUR
  DO
  BEGIN
  DECLARE month_end DATETIME;
  SET month_end = LAST_DAY(DATE(NOW()));
  DECLARE today DATETIME;
  SET today = DATE(NOW());
  DECLARE reg_id VARCHAR(6);
  DECLARE sal INT(8);

   IF month_end=today THEN
   SELECT register_id INTO reg_id, salary INTO sal FROM employees 
   WHERE status ='1';
   INSERT INTO tbl_salary values register_id=reg_id,amount=sal,salary_date=today,status='0';
   END IF;
   END//
 DELIMITER ;

0 个答案:

没有答案