Enforcing referential integrity - database or application?
443806Feb 2 2007 — edited Feb 13 2007If this is issue has already been threshed out and I am the umpteenth person to ask this in the forum, please let me know and point me to a URL. I have believed in embedding as much logic in the database as possible, and would like to know if I am wrong in believing that.
Foreign keys are tailor made for enforcing referential integrity, and thereby implementing valuable business constraints at a very fundamental level, so that no one - including the application programmer - can mess with them.
However, I have had people tell me that instead of implementing foreign keys, they embed referential integrity checks on their application code that puts data in the database. I don't understand this. What possible advantage would accrue by using the application (viz. PL-SQL, or Java or whatever) to do what the FK does extraordinarily well, and probably, a lot faster too?
Thanks,
Regards,
Srini