DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `cday`( a int )
BEGIN
declare i int;
set i = 1;
while i < a do
insert into day_time (ctime) select (ctime+86400) ctime from day_time order by ctime desc limit 1;
set i = i +1;
end while;
END$$
DELIMITER ;
上述代码 执行方法为 call cday(10);
将往day_time 表插入 9条数据
评论 (0)