DELIMITER $$
CREATE PROCEDURE myFunction()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE (i < 500000) DO
INSERT INTO `test table` (num, name, email)
VALUE (i, CONCAT(‘test’, i), HEX(AES_ENCRYPT(CONCAT(‘test’, i, ‘@test.com’), ‘key’)));
SET i = i + 1;
END WHILE;
END$$
DELIMITER ;
CALL myFunction();
출처 :
http://teragoon.wordpress.com/2012/11/08/mysql-procedure를-이용한-loop-insert/
댓글 없음:
댓글 쓰기