首页 > 代码库 > 清空数据库所有表的数据

清空数据库所有表的数据

declare cursor c_t is select table_name from user_tables;
table_name user_tables.table_name%type;
begin open c_t;
loop fetch c_t into table_name;
exit when c_t%notfound;
execute immediate ‘delete from ‘ || table_name;
end loop;
close c_t;
end;

清空数据库所有表的数据