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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to get the index name of the primary key ?

Re: How to get the index name of the primary key ?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 27 Nov 1998 14:32:15 GMT
Message-ID: <3664b7c4.10881116@192.86.155.100>


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  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

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

Original text of this message

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