![]() |
Implementation of Business Rules Via Database Stored Procedures & Triggers |
Traditionally, the logic that governed the functionality of an application was an intrinsic part of the code, itself. This meant that any other applications that used the same business rules had to have the same basic code segment within it. As long as the business rules did not change, this worked well enough. However, if a change needed to be made to the business rules, then a change to the application code had to be made, as wellnot just to one set of code but to all the other sets.
A better solution is to implement business rules in database code that is created and executed directly on the database. These database code segments are called stored procedures or triggers. The application code merely calls the stored procedure. Therefore, if the business rules change, only the stored procedure code needs to be updated and the application does not need to get a change request. Code that is saved as a stored procedure can be executed anytime it is called from any screen in the application. Code that is saved as a trigger will execute only upon an INSERT, UPDATE or DELETE table operation.
When coding your database system, Lyon Technologies, Inc. will implement the
application code on the database via the use of stored procedures and triggers
as much as possible. This powerful design strategy will enable you to enforce
business rules regardless of the origin of the SQL statement and the application
that is sending it, thereby reducing the time required to locate the code, modify
it, and test the changes. In short, you can maintain your database system more
easily in less time.
print this explanation | close this window