Subject RE: [firebird-support] Re: get foreign key
Author Rick Debay
> if the user change the currency_id in the customer record then i have
to change all the currency_id in sales order which reference to this
customer

Cascading update on the foreign key.

> i have to prevent the user from changing the currency id ones its been
used in sales order

Before update trigger on the sales order which will prevent updates once
the sales order has been processed. You can either ignore the update
and log the fact, or throw exception. If the latter, the cascading
update may not work.

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of reynaldi81
Sent: Tuesday, April 10, 2007 10:42 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: get foreign key

> So, many companies do not actually delete a customer's record like
that.
> Instead, they have a flag in the record that specifies whether the
> customer is an "active" customer or not. When the user tries to
"delete"
> a customer, the software simply marks the customer "inactive" or
> "deleted", which causes their information to not show up on active
> customer lists, etc., but doesn't actually delete any information
from the
> database.


You're right. Deleting a record is a bad idea. however, i do need to
know whether the current customer record have active foreign key
references. consider this case. i have "currency_id" field in customer
table. this currency_id will be used in each sales order. if the user
change the currency_id in the customer record then i have to change all
the currency_id in sales order which reference to this customer.
so, i have to prevent the user from changing the currency id ones its
been used in sales order.

Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.