Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find primary keys?
On Tue, 08 Apr 1997 00:00:12 +0800, Michael Ho <infoage_at_hk.super.net> wrote:
>Tim Spellman wrote:
>>
>> I would like a list of all the primary key columns in all my tables.
>> I'm
>> thinking of something simple like
>>
>> select table_name, column_name from cols where <what is the condition?>;
>
I beg your pardon for my previous faulty message!
The following statement selects important information about primary
keys,
for more information see the definitions of the used views:
select bb.table_name, bb.column_name, bb.position, aa.status, aa.owner from all_constraints aa, all_cons_columns bb where
aa.table_name like upper('&LIKE_PATTERN_OF_TABLE_NAME') and aa.constraint_type='P' and aa.constraint_name=bb.constraint_name and aa.owner=bb.owner