Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- based on
- -- https://dev.mysql.com/doc/refman/5.7/en/while.html
- -- https://dev.mysql.com/doc/refman/5.7/en/stored-programs-defining.html
- DROP PROCEDURE IF EXISTS `myproc`;
- DELIMITER $$
- CREATE PROCEDURE `myproc`()
- BEGIN
- DECLARE i INT DEFAULT 1;
- WHILE i <= 10 DO
- INSERT INTO test (id) VALUES (i);
- SET i = i + 1;
- END WHILE;
- END $$
- DELIMITER ;
- CALL `myproc`;
- DROP PROCEDURE IF EXISTS `myproc`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement