我网站里面的文章用火车头采集发布上去的,因为几百篇文章不能一下子发不出去所以发布时间都是一个月以后的同一个时间,在火车头里不知道怎么把时间弄成递增的形式发布,所以就统一的改成了两个月以后的某个时间定时发布的,现在想在数据库里改成每天发布5篇文章,写了下面语句,先查询5条符合条件的要改的记录然后更新发布时间为当天,改完之后再查询5条改成当天加1天,之后再查询改成当天加2天以此类推,知道查出的条数小于5条停止,但是总是报错不知道哪里有问题
create procedure settime()
begin
DECLARE numb INT DEFAULT 5;
DECLARE numb2 INT DEFAULT 1;
while numb>4
begin
update article1
set adddate
=replace(adddate
,'2019-09-23 10:00:00',DATE_ADD('2019-08-04 10:00:00',INTERVAL @numb2 DAY)) where (SELECT adddate
FROM article1
where adddate
='2019-09-23 10:00:00'limit 0,5);
set @numb=FOUND_ROWS();
set @numb2=@numb2+1;
end;
end;
call settime();
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'begin update article1
set adddate
=replace(adddate
,'2019-09-23 10:00:00',' at line 6