Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get primary key
"Florian Hieke" <florian.hieke_at_t-online.de> wrote in message
news:3B46D8A8.7050808_at_t-online.de...
> Hi,
> maybe it's quite a silly question but is there a way to get a table's
> primary key via SQL or PL/SQL? I'm thankful for any hint.
> Thanks, Florian
>
select column_name
, column_position
from user_cons_columns cc
, user_constraints c
where c.table_name = '<your table>'
and c.constraint_type = 'P' and cc.constraint_name = c.constraint_name
Hth,
Sybrand Bakker, Senior Oracle DBA Received on Sat Jul 07 2001 - 07:54:56 CDT