Search code examples
sqloracle-databaseconstraintsuser-object

user_objects oracle


I would just like to ask what is the difference between user_constraints and user_objects.

I have two databases and run a script on both DB that resulted a unique constraint error.

To solve the problem I deleted the constraint on user_constraint table for both DB. After that DB1 run without error. DB2 however failed, I checked the user_constraint for both db and the constraints was deleted.

I was asked to check the user_objects and found that DB2 has that same constraint_name as the object_name in the user_objects table.

Any info regarding their relationship, use, similarites, etc will be appreciated.

Thanks..


Solution

  • The constraint should be dropped with:

    Alter table table_name drop constraint constraint_name;
    

    The difference is simple: User_objects contains all the objects in database and user_constraints contains only the constraints.