When Is a Trigger Fired?

Previous
Previous
Next
Next

A trigger is fired based on a triggering statement, which specifies:

If a trigger contained the following statement:

AFTER DELETE OR INSERT OR UPDATE ON employees ...

then any of the following statements would fire the trigger:


DELETE FROM employees WHERE ...;
INSERT INTO employees VALUES ( ... );
INSERT INTO employees SELECT ... FROM ... ;
UPDATE employees SET ... ;

An UPDATE statement might include a list of columns. If a triggering statement includes a column list, the trigger is fired only when one of the specified columns is updated. If a triggering statement omits a column list, the trigger is fired when any column of the associated table is updated. A column list cannot be specified for INSERT or DELETE triggering statements. In Example: Creating a Database Trigger WIth the AFTER Option the audit_sal trigger specifies the salary column, and is only fired after an UPDATE of the salary of an employee in the employees table. Updates of other columns would not fire the trigger.