Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Table Triggers

A Table trigger is SQL or code automatically executed as a result of the modification of data in a database Table. Its general purpose is to maintain consistent information  across the database. For example, a trigger might be used to define validations that must be performed every time a value is modified, or to perform deletions in a secondary Table when a record in the primary Table is deleted.

In Enterprise Architect, a Table trigger is modeled as a stereotyped operation, but managed using the Table's Constraints screen.

Access     In diagram or Project Browser | Right-click on Table | Features & Properties | Operations > Constraints | Add New Constraint (Ctrl+N)

Create a Table Trigger

Step

Action

See also

1

On the Constraint tab of the Columns and Constraints screen, a new constraint is automatically created and assigned the default constraint name and a Type of index.

Overtype the constraint name with a name that identifies the constraint as a trigger, such as TRG_OnCustomerUpdate. (The TRG_ prefix is optional.)

 

 

2

In the Type field, change the value from index to trigger.

 

 

3

In the Statement property, type in the entire trigger code including the CREATE_TRIGGER statement.

If the statement is long, click on the expansion button ( ... ) at the end of the field and type the code into the Trigger Statement for constraint <table name> dialog.

 

Languages supported

Options - Code Editors

 

4

If necessary (and if the DBMS you are using supports it), you can type a formatted comment on the trigger in the field on the Notes tab.

 

 

5

Click on the Close button.

 

 

 

Delete a trigger

If you do not want to keep a trigger, either:

·Right-click on it in the list and select Delete constraint '<name>', or
·Click on the item and press Ctrl+D

 

The trigger is immediately deleted.

Learning Center topics

·(Alt+F1) | Enterprise Architect | Database Engineering | Physical Data Model | Create Trigger
?>