sql >> Databáze >  >> RDS >> Oracle

Jak zkrátit všechny uživatelské tabulky?

declare

begin

for c1 in (select table_name, constraint_name from user_constraints) loop
    begin
        execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name);
    end;
end loop;

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

for c2 in (select table_name, constraint_name from user_constraints) loop
    begin
        execute immediate ('alter table '||c2.table_name||' enable constraint '||c2.constraint_name);
    end;
end loop;

end;
/


  1. Analýza I/O výkonu pro SQL Server

  2. MYSQL UPDATE SET ve stejném sloupci, ale s více klauzulemi WHERE

  3. Jaký je ekvivalent REF CURSOR společnosti Oracle v MySQL?

  4. Oracle generuje řádky plánu s intervalem