0
Je dois seulement exécuter la procédure les lundis; donc je fais d'abord un test le WEEKDAY() mais il y a une erreur de syntaxe et je ne peux pas trouver ce qui ne va pas?Création d'une erreur de procédure journalier()
CREATE DEFINER=`root`@`localhost` PROCEDURE `fm_Upd_Histo_Inv`()
BEGIN
-- Test if it is Monday
CASE WEEKDAY(curdate()) = 0 then
insert into db1w_histo_inventory (year, week, store, total, to_do)
select year(curdate()),
WEEKOFYEAR(curdate()),
S.store,
count(S.INVDATE) as TotalToDo,
sum(datediff(curdate(), S.INVDATE) > '365') as 'TO_DO'
from mrqr_stock S
left join mrqr_organisms O
on O.ORGANISM = S.STORE
where (O.ORGANISM like '01%'
or O.ORGANISM like 'VV%'
or O.ORGANISM like 'IK%')
group by S.STORE
end;
END
Quels SGBD utilisez-vous? Ajouter le tag associé – Jens