Home » SQL & PL/SQL » SQL & PL/SQL » Help checking constraints
Help checking constraints [message #196661] Fri, 06 October 2006 07:31 Go to next message
Messages: 4
Registered: September 2006
Junior Member

I've just deleted some data from my database. In order to do this I had to disable all foreign key constraints on beforehand. If I've done the deletion correct, none of the these constraints should be violated. In order to verify this, I need a query that checks all foreign key constraints. I.e., that no foreign key is an orphan without a corresponding primary key. Is there a simple way of doing this, like e.g.: "CHECK [table] CONSTRAINTS"

Re: Help checking constraints [message #196663 is a reply to message #196661] Fri, 06 October 2006 07:39 Go to previous messageGo to next message
Messages: 381
Registered: September 2006
Location: UK
Senior Member
Just try re-enabling the constraint but use an "exceptions into" clause to capture any rows which violate the constraint.
Re: Help checking constraints [message #196665 is a reply to message #196663] Fri, 06 October 2006 07:45 Go to previous message
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
If you just want to check that they are valid, just re-enable them. If there are any invalid foreign key constraints, they'll error on re-enable.

Previous Topic: seperate the First Name and Last Name
Next Topic: unable to insert column from other table
Goto Forum:

Current Time: Fri Jul 28 12:11:32 CDT 2017

Total time taken to generate the page: 0.14437 seconds