バッチ・データの挿入のテスト

1391 ワード


-- -------------------------------------------
-- f_vircode
-- -------------------------------------------
DROP PROCEDURE IF EXISTS f_vircode;
DELIMITER $
CREATE PROCEDURE f_vircode(IN loop_times INT)
BEGIN
	DECLARE id INT;
	DECLARE country VARCHAR(255);
	DECLARE province VARCHAR(255);
	DECLARE city VARCHAR(255);
	DECLARE postCode INT DEFAULT 0;
	DECLARE createTime TIMESTAMP;
	
	DECLARE var BIGINT DEFAULT 0;
	DECLARE	num INT DEFAULT 0;
	DECLARE done BOOLEAN DEFAULT FALSE;
	
	SET autocommit = 0;
	SET @c = 100000000007213;
	flag: WHILE var < loop_times DO
		IF var > loop_times THEN
			LEAVE flag;
		END IF;
	
		SET var = var + 1;
		SET @c = @c + 1;
		INSERT INTO t_table_tt VALUES(@c, '2010-01-01 00:00:00', '2020-12-31 23:59:59', '1091', 0, '2015-01-09 15:47:23', @c, @c, 0, NULL, NULL, 1);

	END WHILE;
	COMMIT;
END
$
DELIMITER ;


-- -------------------------------------------
CALL f_vircode(100000);
-- -------------------------------------------
SELECT t.* FROM t_table_tt t;
SELECT t.* FROM t_table_tt t ORDER BY t.code DESC LIMIT 100;

-- -------------------------------------------