ORA-02298: Cannot validate (constraint) prompt for a solution that does not find the parent keyword _oracle

Source: Internet
Author: User
Tags sql error

--When importing table data with Pl/sql error ORA-02298: Unable to verify (PNET. POST_CLOB_FK)-parent keyword not found

--Discovery is enabled by the FOREIGN key constraint times error
ALTER TABLE Dm_volrev enable constraint VR_VOLID_FK;

/* Reason analysis:

In the table a you want to insert, there is a primary key connected to another table B, and the value you insert in the Foreign key column of table A cannot be inserted when the primary key column in table B is not found.
The data in the fields that you want to associate with the foreign key in the table must be included in the data in the related fields of the primary table, primarily to see if the data in the two tables is consistent.

The methods to be dealt with are:

 1> does not validate the constrant of the existing data, plus the parameters novalidate.*/ALTER TABLE pn_post ADD CONSTRAINT post_clob_
FK FOREIGN KEY (post_body_id) REFERENCES Pn_post_body_clob (object_id) novalidate;
--2> first See how many of the two tables correspond to the data, select COUNT (*) from Dm_volrev t,dm_volid k where t.vr_volid = K.vi_volid;
--Look at individual data separately, and discover that the foreign key table has a row of select count (*) from Dm_volrev t;
Select COUNT (*) from Dm_volid K;
-Multiple rows found and delete select T.vr_volid from Dm_volrev t where T.vr_volid is not in (select K.vi_volid from Dm_volid k);
Delete from Dm_volrev t where t.vr_volid = 479908;
-either directly rerun the statement that enabled the foreign key, or delete the foreign key before creating a new foreign key ALTER TABLE dm_volrev drop constraint vr_volid_fk;


ALTER TABLE dm_volrev ADD CONSTRAINT vr_volid_fk foreign KEY (vr_volid) references Dm_volid (vi_volid) VALIDATE;
/* Enable constraint: Enable (Validate): Enables constraints, creates indexes, and enforces constraints on existing and newly added data.

Enable Novalidate: Enables constraints, creates indexes, and enforces constraints on newly added data, regardless of existing data in the table.
Disable constraint: Disable (novalidate): Closes constraint, deletes index, can modify data of constraint column, and so on. Disable Validate: Closes the constraint, deletes the index, and cannot insert/update/delete the table. * * 

The above is a small series to introduce the ORA-02298: unable to verify (constraints) hint did not find the parent keyword solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.