Trigger updating

In addition, you use triggers to enforce complex business rules centrally at the database level and prevent invalid transactions.

To create a new trigger in SQLite, you use the statement to update 10 rows in a table, the trigger that associated with the table is fired 10 times. If the trigger associated with the table is fired one time, we call this trigger a FOR EACH STATEMENT trigger.

Database-level triggers can help enforce multi-table constraints, or emulate materialized views.

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.

As of version 3.9.2, SQLite only supports FOR EACH ROW triggers.

It has not yet supported the FOR EACH STATEMENT triggers.

A trigger may be specified to fire whenever a DELETE, INSERT, or UPDATE of a particular database table occurs, or whenever an UPDATE occurs on on one or more specified columns of a table.

Last modified 01-Oct-2019 17:07