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: Can I use a trigger?

Re: Can I use a trigger?

From: Robert Fazio <dbabob_at_hotmail.nospam.com>
Date: Tue, 18 Mar 2003 04:45:58 GMT
Message-ID: <Xns9341F1C335DDCdbabobhotmailcom@204.127.204.17>


"S" <bangormeNo_at_Spamhotmail.com> wrote in news:BGvda.416$F21.17607 @eagle.america.net:

> I've got to update two tables, one with a foreign key from the other.
> I keep getting foreign key constraint errors no matter what order I
> update the tables. Can I use a trigger to put the foreign key into
> another table during an update?

Wouldn't help. If you can't update the tables in either order, my guess is you have some sort of circular dependency, a parent that you are not considering, or the folowing.

What are the FK errors. Your problem has to do with the data, not the method. Can you be more specific on the question?

I am going to guess what the issue is: You are trying to update a child record to value that has RI constraint to a value that doesn't exist in the parent table. Then you are trying to update the parent record to the value that you are trying to set the child to.

You can't change the child since the parent doesn't exist, and you can't change the parent since it has children.

You can either enter the parent first, change the child, and delete the parent or...

Another option is to create the constraint as deferrable, and use the set constraints clause so that the constraint is only checked at the commit

> What would it look like?
>
> Thanks
>
>
Received on Mon Mar 17 2003 - 22:45:58 CST

Original text of this message

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