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

Home -> Community -> Usenet -> c.d.o.tools -> Re: finding if field is primary key

Re: finding if field is primary key

From: <sybrandb_at_my-deja.com>
Date: Sun, 19 Nov 2000 12:16:36 GMT
Message-ID: <8v8gb3$7su$1@nnrp1.deja.com>

In article <8v8a85$47b$1_at_nnrp1.deja.com>,   itai_at_digifuel.com wrote:
> Hi,
>
> How can I check which fields in a certain table are part of the
 primary key?
> I want to build a SQL query to give me back the names of these fields.
>
> Thanks in advance,
> Itai.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

select c.table_name,c.constraint_name, column_name from user_constraints c, user_cons_columns cc where c.constraint_type = 'P'
and cc.constraint_name = cc.constraint_name /

Hth,

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Nov 19 2000 - 06:16:36 CST

Original text of this message

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