存储过程插入多条数据测试

插入数据

DROP PROCEDURE IF EXISTS test3;
DELIMITER //
create procedure test3()
begin
        DECLARE i int default 12345678;
        DECLARE count int default 0;
while count<1000
        do
        insert into `t_variable` (`Id`,`ConfigId`,`IsPreset`,`Name`,`Type`,`Parameter`,`UpdateTime`,`UpdatedBy`,`GroupId`)
        values (i, 294597245385311360, 0, i, ‘Constant‘, ‘{\"value\":\"234\"}‘, ‘2020-02-11 19:31:44‘, ‘890852000000000050‘, 294849007291729024);
        set count = count + 1;
        set i = i + 1;
end while;
end //

call test3();

删除数据

DROP PROCEDURE IF EXISTS test3;
DELIMITER //
create procedure test3()
begin
        DECLARE i int default 123457;
        DECLARE count int default 0;
while count<1000
        do
        delete from t_variable where ConfigId = 294597245385311360 and Id = i;
        set count = count + 1;
        set i = i + 1;
end while;
end //

call test3();

相关推荐