Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to get the index name of the primary key ?
A copy of this was sent to "Bernhard Mandl" <b.mandl_at_ping.at>
(if that email address didn't require changing)
On Fri, 27 Nov 1998 14:25:27 +0100, you wrote:
>Hello,
>
>I guess it must be in one of the system tables
>
>1.) if a table has a primary key defined and
>2.) if so, what's the index name of the primary key
>
>Does anyone know how to query this info ?
>
SQL> create table foo ( x int constraint x_pk primary key ); Table created.
SQL> select owner, constraint_name from user_constraints 2 where constraint_type = 'P' and table_name = '&1';
Enter value for 1: FOO
old 2: where constraint_type = 'P' and table_name = '&1'
new 2: where constraint_type = 'P' and table_name = 'FOO'
OWNER CONSTRAINT_NAME ------------------------------ ------------------------------ TKYTE X_PK
its in the *_constraints tables with a constraint type of 'P'...
>thanks
>
>Bernhard
>
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Nov 27 1998 - 08:32:15 CST