Home > database >  Mysql server built bulk data stored procedure
Mysql server built bulk data stored procedure

Time:02-24

Made data/* */
Delimiter//
DROP PROCEDURE IF the EXISTS mytestpro; If there is a delete *//*
CREATE PROCEDURE mytestpro ()
The BEGIN

DECLARE INT I;
DECLARE j VARCHAR (200);
The SET I=2;
WHILE I & lt; 1000 DO/* cycle has started to build data */

The SET j=CONCAT (' name ', I);
INSERT INTO CD (` Cd_name `, ` Cd_code `) VALUES (j, CONCAT (' 001 ', I));/* * build data/
The SET I=I + 1;
END
WHILE;
END//
Delimiter.

CALL mytestpro (); Call a stored procedure/* */

DROP PROCEDURE mytestpro/made finished delete * */








The second

DELIMITER $$
CREATE PROCEDURE prcd_create_data2 (IN totalCount int)
The begin

DECLARE num int.
The set of num=10;

While numThe set num=num + 1;

INSERT INTO xjltest
(
Cd_name,
Cd_code
)
VALUES (' 1 ', num);
End the while;


END $$
DELIMITER.
  • Related