Title: RE: rename indexes

> -----Original Message-----
> From: John Dunn [mailto:[EMAIL PROTECTED]]
>
> 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

Reply via email to