Database trigger

triggerstriggerprocedural triggerstriggering
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.wikipedia
68 Related Articles

Database

database management systemdatabasesDBMS
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.

PL/SQL

PLSQLMetatranz StepSqlitePL/SQL (Oracle)
In addition to triggers that fire (and execute PL/SQL code) 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.
A database trigger is like a stored procedure that Oracle Database invokes automatically whenever a specified event occurs.

Event (computing)

eventseventevent handler
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.

View (SQL)

viewviewsdatabase view
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.
Some systems support the definition of INSTEAD OF triggers on views.

Insert (SQL)

INSERTInsertinginserts
Be cautious of using additional INSERT/UPDATE/DELETE commands within your trigger, because trigger recursion is possible, causing unwanted behavior.
Note that the two separate statements may have different semantics (especially with respect to statement triggers) and may not provide the same performance as a single multi-row insert.

Firebird (database server)

FirebirdFirebirdSQLFirebird 2.1
Firebird supports multiple row-level, BEFORE or AFTER, INSERT, UPDATE, DELETE (or any combination of 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 previous stable release was version 2.1.6, which added new features including procedural triggers, recursive queries, and support for SQL:2003 MERGE statements.

SQLite

SQLite3SQLite 3SQLite4
SQLite only supports row-level triggers, not statement-level triggers.
For example, it partially provides triggers, and it cannot write to views (however it provides INSTEAD OF triggers that provide this functionality).

Delete (SQL)

DELETE statementdeletes
Be cautious of using additional INSERT/UPDATE/DELETE commands within your trigger, because trigger recursion is possible, causing unwanted behavior.
Executing a statement can cause triggers to run that can cause deletes in other tables.

Procedural programming

proceduralprocedural languageprocedural code
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.

Table (database)

tabletablesdatabase table
A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.

Data integrity

integrityintegrity constraintsDatabase integrity
The trigger is mostly used for maintaining the integrity of the information on the database.

Oracle Database

OracleOracle RDBMSOracle 10g
In addition to triggers that fire (and execute PL/SQL code) 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.

Microsoft Developer Network

MSDNMSDN BlogsMSDN Library
A full list is available on MSDN.

SQL:2003

SQLSQL standard2003 version of SQL
Triggers in Sedna were designed to be analogous to SQL:2003 triggers, but natively base on XML query and update languages (XPath, XQuery and XML update language).

Update (SQL)

UPDATESQL UPDATEupdates
Be cautious of using additional INSERT/UPDATE/DELETE commands within your trigger, because trigger recursion is possible, causing unwanted behavior.

Materialized view

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

SQL PL

Triggers are usually programmed in SQL PL language.

Sedna (database)

SednaSedna XML Database
An example of implementation of triggers in non-relational database can be Sedna, that provides support for triggers based on XQuery.

XQuery

queriedXML query language
Triggers in Sedna were designed to be analogous to SQL:2003 triggers, but natively base on XML query and update languages (XPath, XQuery and XML update language). An example of implementation of triggers in non-relational database can be Sedna, that provides support for triggers based on XQuery.

XPath

XPath 1.0 XPath axesquerying (XPath)
Triggers in Sedna were designed to be analogous to SQL:2003 triggers, but natively base on XML query and update languages (XPath, XQuery and XML update language).

Recursion (computer science)

recursionrecursiverecursively
Be cautious of using additional INSERT/UPDATE/DELETE commands within your trigger, because trigger recursion is possible, causing unwanted behavior.

Primary key

Alternate keydefining database keykey
Also take note of triggers being able to take advantage of schema objects like sequences, in this example audit_id_sequence.nexVal is used to generate unique primary keys in the phone_book_audit table.

PostgreSQL

PostgresPgSQLPgAdmin
PostgreSQL features transactions with Atomicity, Consistency, Isolation, Durability (ACID) properties, automatically updatable views, materialized views, triggers, foreign keys, and stored procedures.

Logic bomb

logic bombscode bomblogicbomb
For example, a programmer may hide a piece of code that starts deleting files (such as a salary database trigger), should he or she ever be terminated from the company.