Cannot truncate a table which is being referenced by other table
Why can't I truncate a table which is being referenced by other table?
This happens even if the child table does not have any records.
I get ORA-02266.
------------------------------------------------------------------
SQL> create table T1 ( col1 number);
Table created.
SQL> create table T2(col2 number);
Table created.
SQL> alter table T1 add constraint PK1 primary key (col1)
2 /
Table altered.
SQL> alter table t2 add constraint fk2 foreign key (col2) references T1
2 /
Table altered.
SQL> truncate table t1 reuse storage;
truncate table t1 reuse storage
*
ERROR at line 1:
ORA-02266: unique/primary keys in table referenced by enabled foreign keys
When everything is lost, future still remains.