Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: finding if field is primary key
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
![]() |
![]() |