Answer the question
In order to leave comments, you need to log in
How to setup event in MariaDB?
There is a task to launch an event only on weekdays. Tried different scripts (examples below) but getting error
SQL Error [1064] [42000]: (conn=303823) check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT DAYNAME(NOW()) NOT IN ('Sunday', 'Saturday') THEN (depends on the IF condition here)
--Скрипт 1
CREATE EVENT `on_rrc`
ON SCHEDULE EVERY 1 DAY STARTS '2020-08-24 08:00:00'
ON COMPLETION PRESERVE ENABLE
DO
begin
IF SELECT DAYNAME(NOW()) NOT IN ('Sunday', 'Saturday') THEN
UPDATE db.table t set t.value = '1' where t.key = 'config_product_rrc';
END IF;
--Скрипт 2
CREATE EVENT `on_rrc`
ON SCHEDULE EVERY 1 DAY STARTS '2020-08-24 08:00:00'
ON COMPLETION PRESERVE ENABLE
DO
begin
IF SELECT DAYOFWEEK(now()) between 2 and 6 then
UPDATE db.table t set t.value = '1' where t.key = 'config_product_rrc';
END IF;
--Скрипт 3
delimiter |
CREATE EVENT `on_rrc`
ON SCHEDULE EVERY 1 DAY STARTS '2020-08-24 08:00:00'
ON COMPLETION PRESERVE ENABLE
DO
begin
if
SELECT DAYOFWEEK(now()) between 2 and 6 then
UPDATE db.table t set t.value = '1' where t.key = 'config_product_rrc';
END if;
END |
delimiter
Answer the question
In order to leave comments, you need to log in
He does not like the select in the du.
The schedule must be set in the schedule
https://stackoverflow.com/questions/15432079/mysql...
Here is an example of how to run on Sunday
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question