利用存储过程批量造数据
-- 创建存储过程test_insert8
DELIMITER ;
CREATE PROCEDURE test_insert8 ()
BEGIN
DECLARE i INT DEFAULT 1;
-- 通过i控制造多少条数据
WHILE i<100
DO
-- 替换为自己的insert语句 保留REPLACE(UUID(), '-', '')
INSERT INTO `lbx_xp_tenant`.`tb_user`(`id`, `account`, `name`, `type`, `tenant_id`, `concat_number`, `regtime`, `stats`, `remark`, `creation_user`, `creation_date`, `modification_user`, `modification_date`) VALUES (REPLACE(UUID(), '-', ''), '123', '1', 1, '1', '1', '2022-04-26 10:59:00', 2, NULL, '00124135', '2022-04-26 10:59:00', '00092225', '2022-04-26 16:18:45');
SET i=i+1;
END WHILE ;
commit;
END;;
-- 执行存储过程test_insert8
CALL test_insert8();
-- 查看所有的存储过程
show procedure status;
--执行完毕自动删除,事了拂衣去,深藏身与名。
DROP PROCEDURE test_insert8;