truncate and delete 的另一个区别

SQL> delete from dept;
delete from dept
*
ERROR at line 1:
ORA-02292: integrity constraint (SCOTT.FK_DEPTNO) violated - child record found


SQL> truncate table dept;
truncate table dept
*
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys

SQL> delete from emp;

14 rows deleted.

SQL> delete from dept;

4 rows deleted.

SQL> rollback;

Rollback complete.

SQL> truncate table emp;

Table truncated.

SQL> truncate table dept;
truncate table dept
*
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys

你可能感兴趣的:(truncate)