Re: how can I determine the primary key for a table?

From: Frank van Bortel <>
Date: Wed, 15 Apr 2009 11:25:25 +0200
Message-ID: <3e194$49e5a806$524b9d64$>

ddf wrote:
> On Mar 30, 12:48 pm, Maxim Demenko <> wrote:
>>> On Mar 30, 11:20 am, "Larry W. Virden" <> wrote:
>>>> I have a set of oracle tables which were set up by people no longer
>>>> available for consultation.
>>> A good reason why the data dictionary contains the information it
>>> does.
>>>> When I select from the all_indexes table, asking about the index_name
>>>> for one of my tables, it lists:
>>>> SQL> select index_name, uniqueness
>>>>         from all_indexes
>>>>         where table_name = 'TABLE_H'
>>>>         ;  2    3    4
>>>> INDEX_NAME                     UNIQUENES
>>>> ------------------------------       ----------------
>>>> TABLE_H_PK                      UNIQUE
> I do understand this, however the example the OP posted clearly shows
> a unique index enforcing the primary key so I tailored the example to
> his given conditions.
> I'd prefer to not confuse the OP with facts he's not using.
> David Fitzjarrell

Sorry to disagree - but the OP only has a unique index, with a confusing name, which led you to believe there is a primary key constraint. All the OP did was querying ALL_INDEXES.

An index, unique or not, is not the same as a constraint.

There's another view to be queried for constraints, as Maxim showed.


Frank van Bortel
Received on Wed Apr 15 2009 - 04:25:25 CDT

Original text of this message