Example: Rule-based Logical View

Previous Next

This is an example of the steps discussed in the help topic "How to define a Rule-based Logical View". The chosen implementation is transitional constraints, as opposed to a batch job called by one or more constraints.

Assume you have a customer relationship management system, where customers are saved in the PERSON table and their addresses in the ADDRESS table. The ADDRESS table can store different types of addresses. You want to provide a Logical View on this model that will present customers and their home and postal addresses in a single form. In order to allow users to manipulate customer data and related home and postal address data directly through this same form, you turn the Logical View into a Rule-based Logical View.

The PERSON table has a database-generated PERSON_ID primary key. The ADDRESS table is a child table of PERSON. It has a unique primary key across the columns (PERSON_ID, ADDRESS_TYPE).

The Relationship between PERSON and ADDRESS has Delete Rule = Cascading.



collapseStep 1: Define and test the logical view
collapseStep 2: Set constraint flags
collapseStep 3: Plan rules
collapseStep 4: Set column attributes
collapseStep 5: Retrieve database key ahead of time
collapseStep 6: Deal with INSERT of person data
collapseStep 7: Deal with INSERT of address data in new view records
collapseStep 8: Deal with INSERT of address data in existing view records
collapseStep 9: Deal with UPDATE of address data
collapseStep 10: Deal with DELETE of address data



See also

Rule-based Logical Views

Transitional constraints

Logical Views