This article uses an example to describe how to create a stored procedure in MySQL and add records in a loop. Share with you for your reference, the details are as follows: First create, then call: -- Create stored procedure 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 the stored procedure CALL myproc(); PS: Here are two commonly used SQL online tools for your reference (including SQL statement usage instructions): SQL online compression/formatting tool: SQL code online formatting and beautification tool: Readers who are interested in more MySQL-related content can check out the following topics on this site: "MySQL stored procedure skills", "MySQL common function summary", "MySQL log operation skills", "MySQL transaction operation skills summary" and "MySQL database lock related skills summary" I hope this article will be helpful to everyone's MySQL database design. You may also be interested in:
|
<<: Example of how to reference environment variables in Docker Compose
>>: Fabric.js implements DIY postcard function
Table of contents 1 Create mount directories and ...
After a lot of trouble, I finally figured out the...
SQL UNIQUE constraint The UNIQUE constraint uniqu...
Table of contents illustrate 1. Enable Docker rem...
External temporary tables A temporary table creat...
Table of contents Preface 1. The process of using...
1. Delete node Execute kubectl delete node node01...
Table of contents SQL execution order bin log Wha...
Table of contents Common compression formats: gz ...
Method 1: <input id= "File1" type= &q...
Margin of parallel boxes (overlap of double margi...
If you want the application service in the Docker...
Table label composition The table in HTML is comp...
Table of contents 1. Basic use of axio 2. How to ...
Table of contents Mixin Mixin Note (duplicate nam...