我有一个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 ;
暂无答案!
目前还没有任何答案,快来回答吧!