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: How to get primary key

Re: How to get primary key

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sat, 7 Jul 2001 14:54:56 +0200
Message-ID: <tke1h476ltpjaa@beta-news.demon.nl>

"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

Original text of this message

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