aspose file tools*
The moose likes JDBC and the fly likes Alter Unique Index Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Alter Unique Index" Watch "Alter Unique Index" New topic
Author

Alter Unique Index

Jane Somerfield
Ranch Hand

Joined: Jul 20, 2002
Posts: 193
I have a table created in following way:

create table TAB1 (
ID number not null,
VAL1_NBR varchar2(30) not null,
VAL2_NBR varchar2(5) not null,
VAL3_CD varchar2(2),
VAL4_NBR varchar2(30) not null,
VAL5_IND char(1),
constraint TAB1_PK primary key (ID)
);

create unique index TAB1_IDX1 on TAB1 (
VAL1_NBR ASC,
VAL2_NBR ASC,
VAL3 CD ASC
);

Now I need to change the unique index to add one more value
"VAL4_NBR". How do I use alter command to do it?

Thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Jane,
You can use the "alter index" command. However, I would recommend dropping the existing index and creating a new one. The database needs to rebuild the index either way. And using "create index" gives you the command if you need to build the index in the future.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alter Unique Index
 
Similar Threads
JPA (TopLink) DB2 table generation
sequence in oracle
Can we add a Field(column) in a table dynamically?
update while doing save in hibernate
Debugging HTTP 500