create procedure wk() begin declare i int; set i = 1; while i < 5 do insert into t (myday) values (date_sub(curdate(),interval -i day)); -- select i; set i = i +1; end while; end $$