USE project;
DROP PROCEDURE IF EXISTS project.delete_test_user;
delimiter $$
CREATE PROCEDURE project.delete_test_user()
BEGIN

set @vUser=1;
#test_user~9 删除用户信息表中数据
while(@vUser<=10)
do

set @vSqlStr=concat('delete from `test_user_',@vUser%10,'`');

prepare stmt from @vSqlStr;
execute stmt;
deallocate prepare stmt;

COMMIT;

set @vUser=@vUser+1;
end while;

end $$
delimiter ;

CALL project.delete_test_user();

posted on 2017-10-09 14:15  新美好时代  阅读(187)  评论(0编辑  收藏  举报