Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Finding tables without Primary Keys

John_75Jun 22 2010 — edited Jun 22 2010
DB version : 10g Release 2

We have several tables that don't have a Primary Key !

I need to use USER_CONSTRAINTS view to find which of those tables that don't have a primary key.
The following query won't work as it plainly returns all records where CONSTRAINT_TYPE != 'P'
select table_name from user_Constraints WHERE constraint_type != 'P'
I need to skip those table_names which have at least one occurence of CONSTRAINT_TYPE = 'P'.
This post has been answered by Nimish Garg on Jun 22 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2010
Added on Jun 22 2010
7 comments
11,358 views