DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Add a column to the Primary Key?

  1. #1
    Join Date
    Mar 2006
    Posts
    74

    Add a column to the Primary Key?

    Due to a design flaw i want to add a column to the primary key:

    alter table myTable modify primary key pk_myTable(old_column1, old_column2, new_column)


    oracle doesnt accept it? how can i change the pk without removing it, all the FKs that reference it and recreating them all again?

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    you can't
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    There is no other way but to drop the existing PK and create a new one with the additional column.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Mar 2006
    Posts
    74
    *cries*

  5. #5
    Join Date
    Mar 2006
    Posts
    74
    okay, here's another related question.. what tool do you guys use to make your tables structure? im talking about something like maybe what Microsoft Access is to Jet.. what is like that for oracle?

    i cant believe that everyone really sits down with toad/equiv and types

    create table blah
    add constraint xyz
    ...

  6. #6
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    some people use a design program which generates the code for them

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width