Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Primary Key
Try this: It will return the Primary Key Name and the fields that make up the PK.
SELECT UCC.CONSTRAINT_NAME, UCC.COLUMN_NAME FROM USER_CONSTRAINTS UC, USER_CONS_COLUMNS UCC
WHERE UC.CONSTRAINT_TYPE = 'P' --PRIMARY KEY 'P' --FOREIGN KEY 'F'
AND UC.TABLE_NAME = '*********' AND UC.CONSTRAINT_NAME = UCC.CONSTRAINT_NAME AND UC.TABLE_NAME = UCC.TABLE_NAME
Greg Vitetzakis V Greg Vitetzakis V.P. Professional Services OSTnet (Open Source Technologies Inc.) www.ostnet.com
"Peter Chase" <chasep99_at_excite.ca> wrote in message
news:Mj9n6.1967$br1.49775_at_sodalite.nbnet.nb.ca...
> I am using Oracle 8i Personal Edition. Is there an sql statement that I
can
> use that will return the primary key for a given table.
>
>
Received on Wed Feb 28 2001 - 12:28:34 CST
![]() |
![]() |