Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Primary Key
-----Original Message-----
From: Kram [mailto:myoung_at_optushome.com.au]
Posted At: Tuesday, March 12, 2002 5:43 AM
Posted To: server
Conversation: Primary Key
Subject: Primary Key
>> How do I find the primary key of a table?
SELECT constraint_name FROM user_constraints
WHERE constraint_type = 'P' AND
table_name = <appropriate_table_name> ;
Now, how do you find the primary key columns and in the correct order ?
SELECT column_name FROM user_cons_columns WHERE constraint_name = (
SELECT constraint_name FROM user_constraints WHERE constraint_type = 'P' AND table_name = <appropriate_table_name>
HTH
regards,
Norman.
Norman Dunbar EMail: Norman.Dunbar_at_LFS.co.uk Database/Unix administrator Phone: 0113 289 6265 Fax: 0113 289 3146 Lynx Financial Systems Ltd. URL: http://www.Lynx-FS.com ------------------------------------------------------------------------