Home » SQL & PL/SQL » SQL & PL/SQL » How to add column in an index (oracle 9i, 10g)
How to add column in an index [message #489601] Mon, 17 January 2011 23:02 Go to next message
rajesh4851
Messages: 89
Registered: January 2007
Member
Hi,
I have created one unique index on one column of my table. Now i would like to add one more column in the same index without dropping the index. Pls suggest how to achive it.?

SQL  > CREATE TABLE DEBUG_TABLE
  2  (
  3    SLNO          NUMBER,
  4    MESSAGE       VARCHAR2(4000 BYTE),
  5    CREATED_DATE  DATE                            DEFAULT SYSDATE,
  6    CREATED_TIME  TIMESTAMP(6)                    DEFAULT SYSDATE
  7  );

Table created.

SQL  > CREATE UNIQUE INDEX index_debug1 ON debug_table (SLNO);

Index created.

SQL  > ALTER INDEX index_debug1 ADD COLUMN  MESSAGE; 
ALTER INDEX index_debug1 ADD COLUMN  MESSAGE
                         *
ERROR at line 1:
ORA-02243: invalid ALTER INDEX or ALTER MATERIALIZED VIEW option


SQL  > 


Regards,
Raj
Re: How to add column in an index [message #489603 is a reply to message #489601] Mon, 17 January 2011 23:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You cannot add a column to index, drop and recreate it.
For any statement syntax or syntax error, please FIRST have a look at Database SQL Reference.

Regards
Michel

[Updated on: Mon, 17 January 2011 23:14]

Report message to a moderator

Re: How to add column in an index [message #489604 is a reply to message #489601] Mon, 17 January 2011 23:11 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Pls suggest how to achive it.?

I want to teach my goat how to fly.
Pls suggest how to achive it.?
Re: How to add column in an index [message #489605 is a reply to message #489604] Mon, 17 January 2011 23:19 Go to previous messageGo to next message
rajesh4851
Messages: 89
Registered: January 2007
Member
I have requested for work around/ alternative solutions, don't misunderstand.
Re: How to add column in an index [message #489606 is a reply to message #489605] Mon, 17 January 2011 23:22 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I have requested for work around/ alternative solutions
why do you assume that "around/ alternative solutions" even exist?
Re: How to add column in an index [message #489612 is a reply to message #489605] Tue, 18 January 2011 01:42 Go to previous messageGo to next message
John Watson
Messages: 8988
Registered: January 2010
Location: Global Village
Senior Member
Quote:
I have requested for work around/ alternative solutions, don't misunderstand.
Are you trying to minimize the downtime? If so, you could create a new index on both columns (use the online option) before dropping the original index. Then rename it, if you want to keep the name the same.
Re: How to add column in an index [message #489665 is a reply to message #489612] Tue, 18 January 2011 07:13 Go to previous message
rajesh4851
Messages: 89
Registered: January 2007
Member
Yes Jhon, Thanks for the suggession.
Previous Topic: Het the output of a String in Format passed.
Next Topic: UTL_FILE.PUT_LINE is not writing data to a file
Goto Forum:
  


Current Time: Mon Aug 25 16:36:41 CDT 2025