Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners

ASA Maestro online Help

Prev Return to chapter overview Next

Create Trigger Wizard

Create Trigger Wizard guides you through the process of creating of a new table trigger.

The basic principles of Create Object Wizards in ASA Maestro are covered by the corresponding topic. See below to find the description of wizard steps that are unique to the current object.

 

Specifying trigger properties

To define a new trigger, you need to set its NameType (Before, After, Resolve) This option determines whether the function is called before or after the event.

 

Comment

This field contains a comment to the table trigger.

 

Event

One of Insert, Update, Update Fields or Delete; this specifies the event that will fire the trigger.

 

Field list

This is available when Update of option is selected in Event select. You can specify which fields are to be updated to cause the trigger being fired.

 

When expression

If you supply when expression, the SQL statements specified as trigger steps are only executed for those rows for which the WHEN clause is true. If no WHEN clause is supplied, the SQL statements are executed for all rows.

 

Subject (Row, Statement)

This specifies whether the trigger procedure should be fired once for every row affected by the trigger event, or just once per SQL statement.

 

Order

Triggers of the same type (insert, update, or delete) that fire at the same time (before, after, or resolve) can use the clause to determine the order that the triggers are fired. Specifying 0 is equivalent to omitting the clause.

 

New name, Old name, Remote name

The clauses allow you to refer to the inserted, deleted or updated rows. For the purposes of this clause, an update is treated as a delete followed by an insert.

 

An Insert event takes the new name clause, which represents the inserted row.
A Delete event takes the old name clause, which represents the deleted row.
An Update takes the old name clause, which represents the row before the update, and it takes the new name clause, which represents the row after the update.

 

The meaning of old name and new name differs, depending on whether the trigger is a row-level or a statement-level trigger.

 

For row-level triggers, the old name clause allows you to refer to the values in a row prior to an update or delete, and the new name clause allows you to refer to the inserted or updated values. The OLD and NEW rows can be referenced in BEFORE and AFTER triggers. The new name clause allows you to modify the new row in a BEFORE trigger before the insert or update operation takes place.
For statement-level triggers, the old name and new name clauses refer to declared temporary tables holding the old and new values of the rows. The default names for these tables are deleted and inserted.

 

The Remote name clause is for use with SQL Remote. It allows you to refer to the values in the VERIFY clause of an UPDATE statement. It should be used only with RESOLVE UPDATE or RESOLVE UPDATE OF column-list triggers.

 

 

Specifying trigger definition

Here you can specify the trigger definition. Specify the trigger steps to be executed when the trigger fires. The step is optional: you can do it later using a non-modal editor.

 

 

 

 



Prev Return to chapter overview Next