What is a Database Trigger?
A trigger is a set of actions that are run automatically when a specified change or read operation is performed on a specified physical database table. The change operation can be an insert, update, or delete high level language statement in an application program. The read operation can be a fetch, get, or read high level language statement in an application program. As well as from high level languages, these operations could also originate with queries, ODBC, JDBC, certain CL commands for example RCVF, interactive SQL, embedded SQL or Call Level Interface SQL.
This is in contrast with LANSA triggers which are special LANSA functions that run automatically when a specified database operation occurs via LANSA. The implementation of database triggers with LANSA is subsequently referred to as "LANSA DB Triggers" or "Database Triggers".
Database Triggers are only implemented for database access occurring on IBM i in an RDMLX partition.
Before enabling LANSA DB Triggers for a table ensure that you thoroughly understand the potential implications for your existing applications.
Please refer to the following topics in this guide. You may also find the Database Trigger Architecture useful. It is also recommended that the section on "Triggering automatic events in your database" in the DB2 for IBM i Database Programming manual or in the IBM Infocenter, and the section on "Triggers" in the Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for IBM i red book be read and understood.