Previous Topic: Example: Relationship Override TemplateNext Topic: Add a Table Override Trigger


Table Override Templates

To enforce specific business rules for individual tables, you can use a table override template to change the way a built-in trigger behaves for an individual table. For example, suppose that each time an ordered line item is inserted into the ORDER_LINE table, you want to add the order_quantity amount from the ORDER_LINE table to the product_sold_quantity in the PRODUCT table. One way to achieve the behavior is to create a table override trigger for the ORDER_LINE table that performs the additional task.

When you create custom table triggers and attach them to tables, you override the standard CA ERwin Data Modeler scheme, which combines the different built-in templates. By default, when a new table level template is created, template code is inserted that produces the standard built-in trigger. Usually, you can leave the built-in trigger code as is, and insert the additional code necessary for the custom business rule after the section.