Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find out which column has the primary key?

Re: How to find out which column has the primary key?

From: Holger Heidenbluth <keeptool_at_compuserve.com>
Date: 1997/05/09
Message-ID: <33731A6F.2D52@compuserve.com>#1/1

Atif Ahmad Khan wrote:
>
> I am trying to find out which column in a table has the primary key.
> describe tablename doesn't show it. Any ideas?
>
> Thanks.
>
> Atif Khan
> aak2_at_ra.msstate.edu

You may query the data dictionary to find it out (for example EMP table):

SELECT UCC.COLUMN_NAME
FROM USER_CONSTRAINTS UC, USER_CONS_COLUMNS UCC WHERE UC.TABLE_NAME = 'EMP'
AND UC.CONSTRAINT_TYPE = 'P'
AND UC.CONSTRAINT_NAME = UCC.CONSTRAINT_NAME ORDER BY UCC.POSITION An other way is to use a tool. If you like you may have a look at http://ourworld.compuserve.com/homepages/keeptool . We provide the tool Hora. It showes you much more about the database. Received on Fri May 09 1997 - 00:00:00 CDT

Original text of this message

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