Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find primary keys?

Re: How to find primary keys?

From: Dr. Bachmann, Kurt <Kurt.Bachmann_at_t-online.de>
Date: 1997/04/12
Message-ID: <5iogtt$443$1@news01.btx.dtag.de>#1/1

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

  order by 1,3; Received on Sat Apr 12 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US