Re: ... on update cascade ...

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Tue, 25 Feb 2003 08:43:41 -0800
Message-ID: <3E5B9D3C.470CA89C_at_exesolutions.com>


"Vladimir M. Zakharychev" wrote:

> Not sure it is a good idea to alter primary keys, but if you definitely
> need to do it, try AFTER UPDATE FOR EACH ROW trigger and
> DEFERRABLE foreign key constraint: defer the constraint check
> (SET CONSTRAINT my_fk_cons DEFERRED)
> update the PK, in the trigger update the child table, commit.
> IIRC deferrable constraints are supported since version 8.
>
> You may also want to read this:
> http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:5773459616034
>
> Corrections and additions welcome.
> --
> Vladimir Zakharychev (bob_at_dpsp-yes.com) http://www.dpsp-yes.com
> Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
> All opinions are mine and do not necessarily go in line with those of my employer.
>
> "DeMi" <michal.demyda_at_wp.pl> wrote in message news:b3f95s$4tq$1_at_atlantis.news.tpi.pl...
> > Hi!
> >
> > I have a question. I have two connected tables. One of them is master and
> > the other is slave. They are connected using foreign key. Is there any
> > possibility, when I am changing content of one field in master table, to
> > update these fields in slave table which are connected by a foreign key to
> > that fiels in master table. I know that exist a clause "... ON DELETE
> > CASCADE" for deleting master fields, but I couldn't find "... ON UPDATE
> > CASCADE". How to do sucha thing by hand?
> >
> > Best regards
> > Michal Demyda

It is a rotten idea to update primary keys. Unfortunately some poorly designed applications seem to require it.

Your solution is the best one can make of a bad situation.

Daniel Morgan Received on Tue Feb 25 2003 - 17:43:41 CET

Original text of this message