How to truncate all user tables?

前端 未结 5 2457
抹茶落季
抹茶落季 2021-02-19 08:01

How can I truncate all user table in oracle? I have problem with tables constraints.

5条回答
  •  渐次进展
    2021-02-19 08:30

    No need for variables

    begin
      for r in (select table_name from user_tables) loop
        execute immediate 'truncate table ' || r.table_name;
      end loop;
    end;
    

    Regards K

提交回复
热议问题