`

oracle清空多张表数据

阅读更多

 

清空表数据

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');

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics