100 records are inserted cyclically using stored procedures, and 100 records are stored.
Mysql> delimiter $ mysql> create procedure p3 ()-> modifies SQL data-> BEGIN-> set @ I = 0;-> set @ max = 100; -> while @ I <@ max do-> insert into user values (@ I);-> set @ I = @ I + 1;-> end while; -> end $
How can 100 records be inserted cyclically in the SQL database? Is stored procedure required?
Declare @ a as int
Set @ a = 1
While (@ a <= 100)
Begin
Insert into table1 values ('','','','')
Set @ a = @ a + 1
If @ a> 100
Break
Else
Continue
End
How to extract the first N records or insert N records using the stored procedure?
It is better to extract the first N records and pass N as a parameter to the stored procedure,
You can retrieve the first N pieces of data by sorting the top keywords.
To insert N records, you must first import the data into the stored procedure and use continuous insertion.