没怎么接触过mysql procedure,今天建个calendar表还磨磨唧唧的,记录一下:
CREATE PROCEDURE `new_procedure` (start_date DATA,end_date DATE) BEGIN declare crt_date DATE; set crt_date = start_date; WHILE crt_date < end_date DO insert into table values(crt_date); set crt_date = adddate(crt_date,interval 1 day); END WHILE END