title: How to rename a primary key in Oracle such that it can be reused
body: <p>On Oracle, I create a table like this:</p>
  
  
  
  <pre>
  CREATE TABLE "Mig1"(
    "Id" INTEGER  NOT NULL
    , CONSTRAINT "PK_Mig1" PRIMARY KEY 
  (
     "Id"  ) 
  ) 
  </pre>
  
  <p>Then, I rename the PK:</p>
  
  <pre>
  ALTER TABLE "Mig1" RENAME CONSTRAINT "PK_Mig1" TO "PK_XXX"
  </pre>
  
  <p>Then, I rename the table:</p>
  
  <pre>
  ALTER TABLE "Mig1" RENAME TO "XXX"
  </pre>
  
  <p>Then, I try to create another table that uses the name of the previously renamed table:</p>
  
  <pre>
  CREATE TABLE "Mig1"(
    "Id" INTEGER  NOT NULL
    , CONSTRAINT "PK_Mig1" PRIMARY KEY 
  (
     "Id"  ) 
  ) 
  </pre>
  
  <p>At this point I get: <code>An error occurred: ORA-00955: name is already used by an existing object</code>. And this is because somehow the primary key of the first table is still around in some way although it was renamed. If I try to create the second table like this:</p>
  
  <pre>
  CREATE TABLE "Mig1"(
    "Id" INTEGER  NOT NULL
    , CONSTRAINT "YYY" PRIMARY KEY 
  (
     "Id"  ) 
  ) 
  </pre>
  
  <p>it works. So how do I rename the primary key correctly with all of its associated resources such that its name can be reused?</p>