Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign key to multiple tables ???
In article <32B59047.167E_at_ha.hac.com>, Ed Bruce <Ed.Bruce_at_ha.hac.com> wrote:
>Kirmo Uusitalo wrote:
>> A trigger won't disallow dropping a referenced table, and it doesn't
quarantee
>> data integrity the way foreign key constraint does.
>
>I don't see why you can't code the trigger to guarantee data integrity.
What I meant to say is that having a trigger doesn't quarantee that the referenced FKs actually refer to valid rows in referenced tables. One could disable trigger, update foreign key field to illegal value and then re-enable trigger.
The foreign key constraint, when enabled, guarantees data integrity. If there are illegal foreign key values, the constraint can't be enabled.
Surely triggers can be used successfully to ensure data integrity for new/updated data, keeping in mind that they don't guarantee anything on existing data.
Cheers,
Kirmo.Uusitalo_at_comptel.fi Comptel Oy System Analyst Ruoholahdenkatu 4 tel. +358-9-70011662 00180 HELSINKI fax 70011385 FINLANDReceived on Wed Dec 18 1996 - 00:00:00 CST