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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it possible to update Primary Key Columns ?

Re: Is it possible to update Primary Key Columns ?

From: Chrysalis <cellis_at_iol.ie>
Date: 1997/04/09
Message-ID: <334BE036.5A3A@iol.ie>#1/1

Thomas Kyte wrote:
>
> On 9 Apr 1997 03:48:42 GMT, ceham_at_w3eax.umd.edu (Maurice De Vidts
> NE3S) wrote:
>
> >Hi,
> >
> >
> >I would like to know how I can 'update' a primary key value
> >on a Parent table which has a populated child table ?
> >
> >is there a way to 'cascade' the update to all the child tables ?
> >
>
> You can check out the Update Cascade Package available on
> http://govt.us.oracle.com/ under downloadable utilities (look in the
> 'quick picks' section on the home page).
>
> It uses triggers to capture and propagate updates from a parent to all
> child tables even while declaritive RI is turned on (example of how to
> avoid mutating tables).....
>
> >Thanks,
> >
> >Maurice
> >ceham_at_w3eax.umd.edu
>
> Thomas Kyte
> tkyte_at_us.oracle.com
> Oracle Government
> Bethesda MD
>
> http://govt.us.oracle.com/ -- downloadable utilities
>
> ----------------------------------------------------------------------------
> Opinions are mine and do not necessarily reflect those of Oracle Corporation

While I agree that updating primary keys is possible, it should always be regarded as undesirable. The primary key is the identifier of an object and, while other attribute values may change, the identifier should not. (If it does, is it the same object?) If no non-updatable set of attributes can be found for a primary key, it is worth considering a _surrogate_ or _artificial_ key (possibly system-generated). However, my personal preference is always to use a (non-updatable) set of user-recognised attributes as the primary key wherever possible.

Chrysalis. Received on Wed Apr 09 1997 - 00:00:00 CDT

Original text of this message

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