Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Table DDL duplicates PK and unique index

147712Oct 10 2008 — edited Nov 12 2008
I haven't seen anything specific to this in the forums, but I'm surprised that it hasn't been addressed (unless it's fat fingers on my part).

Generated DDL for a fairly simple table includes both an ALTER TABLE statement for primary key constraint, and a CREATE UNIQUE INDEX for the same constraint. Obviously, the index statement causes a "ORA-00955: Name is already used by an existing object" exception.

My understanding is that the alter statement implicitly creates a unique index, so there ought to be no need to explicitly create the index.

I've observed this behaviour in Sql Dev 1.2 and 1.5.

CREATE TABLE "DT_CALENDAR_WEEK"
...
ALTER TABLE "DT_CALENDAR_WEEK" ADD CONSTRAINT "DT_CALENDAR_WEEK_PK" PRIMARY KEY ("FSC_WK_NUM") ENABLE;

CREATE UNIQUE INDEX "DT_CALENDAR_WEEK_PK" ON "DT_CALENDAR_WEEK" ("FSC_WK_NUM") ;

Am I missing something here? Any constructive suggestions greatly appreciated.

Cheers,

Patrick

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 10 2008
Added on Oct 10 2008
7 comments
1,455 views