Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Primary Key
"Kram" <myoung_at_optushome.com.au> wrote in message
news:Qwgj8.35$an4.4277_at_nsw.nnrp.telstra.net...
> How do I find the primary key of a table?
>
Hi,
select c.table_name, cc.column_name, c.constraint_name
from user_constraints c, user_cons_columns cc
where c.constraint_name=cc.constraint_name
and constraint_type='P'
and c.table_name=<TABLE_NAME>
Also you can use ALL_* or DBA_* table and add OWNER condition.
Regards,
-- Roman Mirzaitov Brainbench MVP for Oracle Administration www.brainbench.comReceived on Tue Mar 12 2002 - 02:58:13 CST