Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find primary keys?
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-3010Received on Thu Apr 17 1997 - 00:00:00 CDT