A trigger is a mechanism for executing a series of SQL statements when a particular action (an INSERT, UPDATE, or DELETE) occurs. The trigger contains a SQL statement that needs to be executed when the trigger is invoked. Triggers are created using solidDB® proprietary stored procedure syntax.
You can create one or more triggers on a table, with each trigger defined to activate on a specific INSERT, UPDATE, or DELETE command. When a user modifies data within the table, the trigger that corresponds to the command is activated.
You can only use inline SQL or stored procedures with triggers. If you use a stored procedure in the trigger, the procedure must be created with the CREATE PROCEDURE command. A procedure invoked from a trigger body can invoke other triggers.
Triggers enable you to:
▪Implement special integrity constraints, such as checking that certain conditions are maintained, for example, to prevent users from making incorrect or inconsistent data changes.
▪Take action based on the value of a row before or after modification.
▪Transfer much of the logic processing to the server, reducing the amount of work that your application needs to do as well as reducing network traffic.