Can I name a primary key?


Is there a way that you can assign a name to the primary key the same
way you can an index?

If I do:
alter table person add primary key(ssn);
create index lastname on person(lname);
select index_name from user_indexes;

Produces:

INDEX_NAME
------------------
LASTNAME
SYS_C00497

How could I change "SYS_C00497" to something more descriptive.



Use instead

ALTER TABLE PERSON
  ADD CONSTRAINT PERSON_PK PRIMARY KEY (SSN)
                                    using index TABLESPACE INDEX;

PERSON_PK or any what you like to have.

Nicolas Bronke
 
 

Hosted by www.Geocities.ws

1