Created
November 27, 2010 01:56
-
-
Save xeoncross/717472 to your computer and use it in GitHub Desktop.
MySQL sample proc showing insert loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> delimiter $$ | |
mysql> | |
CREATE PROCEDURE myFunction() | |
BEGIN | |
DECLARE i INT DEFAULT 1; | |
WHILE (i<=1000000) DO | |
INSERT into table (fk1_id, fk2_id, date) values (i, 1000000 - i, NOW()); | |
SET i=i+1; | |
END WHILE; | |
END$$ | |
mysql> delimiter ; | |
mysql> call myFunction(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment