Truncate reported ORA-02266 error unique/primary key enabled external keyword reference solution

Source: Internet
Author: User

I want to truncate a table today, but an ORA-02266 error is reported

The possible cause is that the primary key is referenced by the quilt table.
The solution is as follows:

SQL> truncate table table_name;

Truncate table table_name *
Error is located in row 1st:
ORA-02266: Unique/primary key-enabled external keyword reference in the table

SQL> ALTER TABLE table_name disable primary key cascade;
The table has been changed.

SQL> truncate table table_name;
The table has been truncated.

SQL> ALTER TABLE table_name enable primary key;
The table has been changed.

SQL>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.