MySQL implements the method of creating a stored procedure and adding records cyclically. mysql Stored Procedure
This example describes how to create a stored procedure and add records cyclically in MySQL. We will share this with you for your reference. The details are as follows:
First create and then call:
-- Create the Stored procedure DELIMITER; // create procedure myproc () begindeclare num int; set num = 1; while num <= 24 doinsert into t_calendar_hour (hourlist) values (num ); set num = num + 1; end while; commit; end; // -- CALL the Stored Procedure CALL myproc ();
PS: here we recommend two commonly used online SQL tools for your reference (including SQL statement usage instructions ):
SQL online compression/formatting tools:
Http://tools.jb51.net/code/ SQL _format_compress
SQL code online formatting and beautification tools:
Http://tools.jb51.net/code/sqlcodeformat