You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
508 B

1 month ago
use dbmgame;
delimiter //
CREATE procedure clean_battle_replay(in p_version bigint, in p_day int)
BEGIN
DECLARE `@i` int(11);
DECLARE `@sqlstr` varchar(2560);
SET `@i`= 1;
WHILE `@i` <= 100 DO
SET @sqlstr = CONCAT("delete from tbbattle_replay_",`@i`," where `battleVersion` < ", p_version, " or `createDay` < ", p_day, ";");
prepare stmt from @sqlstr;
execute stmt;
SET `@i` = `@i` + 1;
END WHILE;
END;
call clean_battle_replay( 22062900, 0);
drop procedure clean_battle_replay;
//
delimiter ;