清空表数据
begin
for i in (select * from user_tables t where t.table_name like '%P_TEST%') loop
execute immediate 'truncate table ' || i.table_name;
end loop;
end;
begin
for i in (select * from user_tables t where t.table_name in ('P_TEST','P_TEST2')) loop
execute immediate 'truncate table ' || i.table_name;
end loop;
end;
拼成清空表数据
select 'truncate TABLE '||TABLE_NAME||';' from user_tables where table_name in ('P_TEST','P_TEST2');