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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Finding out about indexes from system tables

Re: Finding out about indexes from system tables

From: Andrew Hardy <nobody_at_spam.from.news.AdvanticaTech.com>
Date: Thu, 19 Jul 2001 14:53:38 +0100
Message-ID: <9j6ope$sf9$1@sun-cc204.lut.ac.uk>

"Stan Brown" <stanb_at_panix.com> wrote in message news:9j6npf$5fq$1_at_panix3.panix.com...
> I'm working on a littler PerlTK script to allow some operators to do
> lightweight table data changes. I would like to display which fileds in
 the
> table they are working on are "keys". At least in our case I can figure
> this out by looking at what cols have unique indexes. All of our tables
> have unique indexes on thse cols, like:

You should really be looking at the constraints data dictionary items all_constraints and all_cons_columns to find the primary keys.

E.G.

SELECT CC.TABLE_NAME, CC.POSITION, CC.COLUMN_NAME FROM ALL_CONSTRAINTS C
 , ALL_CONS_COLUMNS CC
WHERE CONSTRAINT_TYPE = 'P'
  AND CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME ORDER BY CC.TABLE_NAME, CC.POSITION Andy Received on Thu Jul 19 2001 - 08:53:38 CDT

Original text of this message

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