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: Need an SQL*Plus script to show indexes on a given table

Re: Need an SQL*Plus script to show indexes on a given table

From: Michael Pelzelmeyer <mikepelz_at_netway.at>
Date: 1998/02/04
Message-ID: <34D82876.3D40@netway.at>#1/1

Tom wrote:
>
> Could someone please post an SQL*Plus script that will list the
> indexes and the fields in those indexes for a given table? Thanks!

connect scott/tiger;
select index_name from user_indexes where table_name='EMP';

will give you:
INDEX_NAME



PK_EMP
1 rows selected.

select column_position,column_name
  from user_ind_columns
 where index_name = 'PK_EMP';

will give you:
COLUMN_POS COLUMN_NAME

---------- ------------------------------
         1 EMPNO

1 row selected.

You can use DESCRIBE USER_INDEXES and

            DESCRIBE USER_IND_COLUMNS
to get all the fields in these views.
Just include the two select statements in a script.

Hope that helps
Michael Received on Wed Feb 04 1998 - 00:00:00 CST

Original text of this message

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