Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: changing contents of primary key

Re: changing contents of primary key

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Wed, 10 Mar 1999 21:00:12 -0800
Message-ID: <36E74DDC.3F51@oriolecorp.com>


Sander Smit wrote:
>
> At the company I am working for, there is a database with a meaningful
> primary key: it contains the abbreviated company name.
> Now the company name has been changed, so we want to change the
> abbreviation. There are 25 other systems that have got an interface
> with our database, the primary key is one of the fields in the interface.
>
> Any suggestions? Thanks in advance.
>
> Regards, Sander

Do change a primary key you should do as follows : 1) First a row into the reference table, strictly equal to the previous one but for the primary key value
2) Then look into DBA_CONSTRAINTS to find all foreign key constraints which reference you primary key anbd update the relevant lines 3) Then delete the line with the old primary key value.

Rather boring but works well (phase 2 can be automated).

--
Regards,

  Stéphane Faroult
  Oriole Corporation Received on Wed Mar 10 1999 - 23:00:12 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US