I am trying to create this event but I cannot find the syntax error.
DELIMITER //
CREATE EVENT IF NOT EXISTS auto_decline
ON SCHEDULE
EVERY 1 DAY
DO
UPDATE Appointment SET status = 'Declined' WHERE deadline < CURDATE();
END; //
DELIMITER ;
so Basically I want my database to check every day that if the deadline (deadline is a column with date
format) is already bigger than the current date. However my systems tells me there is a syntax error.
I also tried to use a IF THEN statement
DELIMITER //
CREATE EVENT IF NOT EXISTS auto_decline
ON SCHEDULE
EVERY 1 DAY
DO
IF deadlineToAccept BETWEEN offerSentTime AND CURDATE()
THEN
UPDATE PatientReceivedAppointment SET status = 'Declined';
END IF;
END; //
DELIMITER ;
still I got this syntax error. Notice that in my code there is no warning.