Q
Problem solve Get help with specific problems with your technologies, process and projects.

Foreign keys vs. application logic in Oracle database

Which is the better option between the following: leaving the data integrity to the DB by creating foreign keys or managing them through the application logic?

Which is the better option between the following: leaving the data integrity to the DB by creating foreign keys or managing them through the application logic? I have seen few applications where managing the data integrity through application logic is preferred to the foreign key. I would like to understand if this should be the case even in Oracle 10g. Thanks.
Always, always, always let the database enforce your data integrity. If data integrity is coded in the application, it is very easy for the app to enforce the data integrity in some places but not in others. If the data integrity is coded in the application, how do you guarantee data integrity if you use a different application? If you code the integrity constraints in the database, then these problems do not arise. I have never, in all my years in this businees, seen a case where it is preferrable to move the data integrity rules into the application. And in my opinion, those who do prefer the app over the database for enforcing data integrity do not understand how the database works and why this approach is better.

Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close