This article mainly introduces the method of MySQL to create stored procedures and loopadd records, involving basic mysql stored procedure creation and calling related operations For tips, friends who need them can refer to
. The example in this article describes the method of creating a stored procedure and adding records in a loop in MySQL. Share it with everyone for your reference, the details are as follows:
Create first, then call:
-- 创建存储过程 DELIMITER;// create procedure myproc() begin declare num int; set num=1; while num <= 24 do insert into t_calendar_hour(hourlist) values(num); set num=num+1; end while; commit; end;// -- 调用存储过程 CALL myproc();
The above is the detailed content of Detailed explanation of how MySQL implements the method of creating stored procedures and adding records in a loop. For more information, please follow other related articles on the PHP Chinese website!