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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: rename indexes

RE: rename indexes

From: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Fri, 04 May 2001 10:45:42 -0700
Message-ID: <F001.002F9A5B.20010504101056@fatcity.com>

> -----Original Message-----
> From: John Dunn [mailto:john.dunn_at_sefas.co.uk]
>
> When I create tables with primary keys, Oracle gives the
> indexes a default name.
>
> Can I rename these indexes with meaningful names, or do I
> need to drop and
> recreate my tables, amending create table statements to
> explicitly name the indexes?

You can use "alter index rename" to change the name of the index. Or (a better solution) you can name the enforcing index when you create the primary key.

Examples:
-- In both cases an index will be created with the same name -- as the primary key constraint
create table t

  ( n number constraint t_pk primary key using index tablespace indx,
    d date
  ) ;


create table movie

  ( movie_name varchar2 (30),
    director_name varchar2 (30),
    year number,
    studio_name varchar2 (30),
    constraint movie_pk primary key (movie_name, director_name, year)
                        using index tablespace indx
  )




Jacques R. Kilchoer
(949) 754-8816
Quest Software, Inc.
8001 Irvine Center Drive
Irvine, California 92618
U.S.A.
http://www.quest.com Received on Fri May 04 2001 - 12:45:42 CDT

Original text of this message

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