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: Get the primary key name of a table

Re: Get the primary key name of a table

From: Robert Wehofer <thalion77_at_graffiti.net>
Date: Thu, 17 Mar 2005 07:44:14 GMT
Message-ID: <iza_d.2340$zY6.1570@news.chello.at>

Hello!

Thank you for your advices.

I now use following statement to get the primary key of a table:

SELECT COL.COLUMN_NAME FROM USER_CONS_COLUMNS COL, USER_CONSTRAINTS CON WHERE COL.TABLE_NAME = 'TABLENAME' AND COL.TABLE_NAME = CON.TABLE_NAME AND COL.CONSTRAINT_NAME = CON.CONSTRAINT_NAME AND CON.CONSTRAINT_TYPE='P'; I hope this statement works in all oracle versions.

Robert Received on Thu Mar 17 2005 - 01:44:14 CST

Original text of this message

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