views:

392

answers:

2

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

A: 

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

Khb
-1 Doesn't address the need to handle constraints
APC
+4  A: 

See my answer to this SO question.

DCookie