Truncate table in Oracle getting errors

后端 未结 9 1263
忘了有多久
忘了有多久 2021-02-02 08:11

I got the problem is when I run following command in Oracle, I encounter the error.

Truncate table mytable;

Errors:

         


        
9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-02 08:56

    The error message is telling you that there are other table(s) with a foreign key constraint referring to your table.

    According to the Oracle docs

    You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table.

    The syntax for disabling a foreign key is:

    ALTER TABLE table_name disable CONSTRAINT constraint_name;

提交回复
热议问题