Re: Primary key

From: <catherine_devlin_at_purpleturtle.com>
Date: 5 Apr 2001 12:11:25 GMT
Message-ID: <9ahndd$rb1$1_at_news.netmar.com>


In article <_8wt6.5125$7e6.1913324_at_homer.alpha.net>, Andy Konopka <andy.konopka_at_camtronics.com> writes:
>Can you tell what the actual primary key is an Oracle table when you have
>more than one
>not null definition in a table when you do a describe?
>
>

Try

select

      ucc.column_name
from  sys.user_constraints uc,
      sys.user_cons_columns ucc
where ucc.constraint_name = uc.constraint_name
and uc.table_name = 'PROJECT'
and uc.constraint_type = '(YOUR TABLE NAME, ALL CAPS)'

The 'P's are for Primary.

There's probably a more elegant way... but I've been spoiled by TOAD. :)

  • Catherine
    • Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web ----- http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups NewsOne.Net prohibits users from posting spam. If this or other posts made through NewsOne.Net violate posting guidelines, email abuse_at_newsone.net
Received on Thu Apr 05 2001 - 14:11:25 CEST

Original text of this message