If an exception is raised in a TRANSACTION COMMIT trigger, the changes made by the trigger so far are rolled back and the client application is notified, but the transaction remains active as if COMMIT had never been requested; the client application can continue to make changes and re-request COMMIT.Syntax for database triggers: IBM DB2 for distributed systems known as DB2 for LUW (LUW means Linux Unix Windows) supports three trigger types: Before trigger, After trigger and Instead of trigger.Row level triggers would execute each time a row is affected by the UPDATE.It is important to keep in mind if no rows are affected by the UPDATE command the trigger will not execute any code within the trigger.If exception is thrown from before trigger then operation is aborted and no data are changed.
When using these options you need to keep a few things in mind.
In addition to triggers that fire when data is modified, Oracle 10g supports triggers that fire when schema level objects (that is, tables) are modified and when user logon or logoff events occur.
These trigger types are referred to as "Schema-level triggers". Performing conditional actions in triggers (or testing data following modification) is done through accessing the temporary Inserted and Deleted tables. The following functionality in SQL:2003 was previously not implemented in Postgre SQL: Firebird supports multiple row-level, BEFORE or AFTER, INSERT, UPDATE, DELETE (or any combination thereof) triggers per table, where they are always "in addition to" the default table changes, and the order of the triggers relative to each other can be specified where it would otherwise be ambiguous (POSITION clause.) Triggers may also exist on views, where they are always "instead of" triggers, replacing the default updatable view logic.
The BEFORE option does not allow you to modify tables, that is why input validation is a practical use.
Using AFTER triggers allows you to modify tables such as inserting into an audit history table.
Now let’s say we have a trigger that uses AFTER instead.