Create and use triggers

This section describes each component of the CREATE TRIGGER statement, illustrates some uses for triggers, and describes the advantages of using an SPL routine as a triggered action.

In addition, this section describes INSTEAD OF trigger that can be defined on views.

An SQL trigger is a mechanism that resides in the database. It is available to any user who has permission to use it. An SQL trigger specifies that when a data-manipulation language (DML) operation (an INSERT, SELECT, DELETE, or UPDATE statement) occurs on a particular table, the database server automatically performs one or more additional actions. For triggers defined on views, the triggered action on the base tables of the view replaces the triggering event. For triggers on tables or views, the triggered actions can be INSERT, DELETE, UPDATE, EXECUTE PROCEDURE or EXECUTE FUNCTION statements.

HCL OneDB™ also supports user-defined routines written in C or in Java™ as triggered actions.

For information on how to write a C UDR to obtain metadata information about trigger events, see the HCL OneDB DataBlade® API Programmer's Guide.