Truncate parent table in Oracle when child table is empty

oraclereferential-integritytruncate

Suppose I have a parent table parent referenced by a child table child. The table parent is populated but child is not. Attempting to truncate parent results in

 ORA-02449: unique/primary keys in table referenced by foreign keys  

Is there a way to hint to the DBMS that child is empty, so that the foreign key constraint doesn't need to be disabled?

Best Answer

No, there is no such hint. What you can do is

alter table {child_table} disable constraint {fk_constraint_name};
truncate table {parent_table};
alter table {child_table} enable constraint {fk_constraint_name};