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: Jim Robertson <jrobert_at_ect.enron.com>
Date: 1997/04/17
Message-ID: <335684F4.794BDF32@ect.enron.com>#1/1

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?>;
>
> TIA
> --
> Tim Spellman | IntraNet, Inc. provides
> mission-critical
> TSpellman_at_IntraNet.com | electronic payment systems and related
> 617-527-3399 x564 | solutions worldwide.
 

select a.owner,a.constraint_name,b.column_name

    from dba_constraints a,dba_cons_columns b

    where   a.owner = b.owner
    and     a.constraint_name = b.constraint_name
    and     a.constraint_type = 'P'
   order by a.owner,a.constraint_name,b.position



-- 
Jim Robertson                   Enron Capital & Trade Resources
Information Technology          1400 Smith Street
email: jrobert_at_ect.enron.com    EB-3419B
vmail: 713/853-7801             Houston, Texas 77002 
fax:	713-646-3010
Received on Thu Apr 17 1997 - 00:00:00 CDT

Original text of this message

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