Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > CREATE TRIGGER >

Select Triggers in Table Hierarchies

A subtable in a Dynamic Server database inherits the Select triggers that are defined on its supertable. When you select from a supertable, the SELECT statement activates the Select triggers on the supertable and the inherited Select triggers on the subtables in the table hierarchy.

For example, assume that table tab1 is the supertable and table tab2 is the subtable in a table hierarchy. If the Select trigger trig1 is defined on table tab1, a SELECT statement on table tab1 activates the Select trigger trig1 for the rows in table tab1 and the inherited Select trigger trig1 for the rows in table tab2.

If you add a Select trigger to a subtable, this Select trigger can override the Select trigger that the subtable inherits from its supertable. For example, if the Select trigger trig1 is defined on column col1 in supertable tab1, the subtable tab2 inherits this trigger. But if you define a Select trigger named trig2 on column col1 in subtable tab2, and a SELECT statement selects from col1 in supertable tab1, this SELECT statement activates trigger trig1 for the rows in table tab1 and trigger trig2 (not trigger trig1) for the rows in table tab2. In other words, the trigger that you add to the subtable overrides the trigger that the subtable inherits from the supertable.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]