Re: simple trigger problem ?

From: Job <Job_at_pestilence.net>
Date: 2000/05/08
Message-ID: <3916D9F7.449EF093_at_pestilence.net>#1/1


norab wrote:

> as a project i developed a simple database with oracle designer, including
> application forms.
> Here is what the problem is:
>
> a table customer is linked to a table adress with a many to one
> relationship.
> when i update a customer's home adress via the form, the adress of other
> customers who live at the same adress is also changed.
> off course because if 3 customers live at the same adress, only one adress
> record will be in the adress table. and if one of those three customers
> change adresses, and i update that record, the two other customers will also
> have that changed adress.
>
> I was looking for a solution with database triggers (after update on
> adressen), but the problem is that at that point i dont know WHICH customer
> changed adress.
>
> Is there a solution with database triggers or any other?
> tnx for al help

The solution is to correctly design the database! You need to ensure your current customer is the only one at that address before allowing a change and, if not, then create a new address record. Your trigger could do that, but consider keying the address table by customer number and some seq or home/work/correspondance indicator.
HTH Received on Mon May 08 2000 - 00:00:00 CEST

Original text of this message