create procedure trunTables()
begin
declare flag int default 0;
declare t_name VARCHAR(255);
declare table_name_list CURSOR FOR (select table_name as t_name from information_schema.tables where table_schema='fh-252');
DECLARE CONTINUE HANDLER FOR NOT found set flag = 1;
OPEN table_name_list;
FETCH table_name_list INTO t_name;
while flag != 1 DO -- 循环开始
SET @sqlstr = CONCAT("truncate table ",t_name);
PREPARE stmt FROM @sqlstr;
EXECUTE stmt;
FETCH table_name_list INTO t_name;
end while; -- 循环结束
close table_name_list;
end;
CALL trunTables();
-- 删除存储过程
drop procedure if exists trunTables;