ORA-01408: this list of columns has already been indexed

Oracle SQL-Developer generates DDL statements for existing database tables (items). It is very strange that the generated DDL statements cannot be used in a new database instance. Here's a simplified DDL example

CREATE TABLE AB
  (
    "A"      NUMBER(*,0),
    "B"   NUMBER(*,0),
    "C" VARCHAR2(255 BYTE),
    CONSTRAINT "CHK_AB_A_NN" CHECK (A       IS NOT NULL) ENABLE,
    CONSTRAINT "CHK_AB_B_NN" CHECK (B       IS NOT NULL) ENABLE,
    CONSTRAINT "PK_AB" PRIMARY KEY ("A", "B")
  );
CREATE INDEX "IDX_AB_A" ON "AB"("A");
CREATE INDEX "IDX_AB_B" ON "AB"("B");
CREATE UNIQUE INDEX "PK_AB" ON "AB"("A", "B");

If I execute these instructions on a new oracle instance, I get an error:

SQL-Fehler: ORA-01408: Diese Spaltenliste hat bereits einen Index 1. 00000 - "such column list already indexed"

What is the reason for this error?

+4
source share
2 answers

Part:

CONSTRAINT "PK_AB" PRIMARY KEY ("A", "B")

spawns an index. A primary key constraint cannot exist without an index. However, part:

CREATE UNIQUE INDEX "PK_AB" ON "AB"("A", "B");

. . , , Oracle script:) , .

+8

CREATE TABLE ( "A", "B" ), PRIMARY KEY. , UNIQUE INDEX .

UPDATE: Oracle SQL Developer 3.2.20.09, . , ?

+2

All Articles