Description: Derby allows you to create triggers. When you create a trigger, you define an action or set of actions that are executed when a database event occurs on a specified table. A database event is a delete, insert, or update operation.
Keywords: Triggers, programming trigger actions

# Programming trigger actions

Derby allows you to create triggers. When you create a trigger, you define an action or set of actions that are executed when a database event occurs on a specified table. A database event is a delete, insert, or update operation.

For example, if you define a trigger for a delete on a particular table, the trigger action is executed whenever someone deletes a row or rows from the table.

The `CREATE TRIGGER` statement in the Java DB Reference Manual goes into detail of the complete `CREATE TRIGGER` syntax. This section provides information on defining the trigger action itself, which is only one aspect of creating triggers.

This section refers to the `CREATE TRIGGER` statement as the trigger actions.

- Trigger action overview
  A trigger action is a simple SQL statement.
- Performing referential actions
  Derby provides referential actions. Examples in this section are included to illustrate how to write triggers.
- Accessing before and after rows
  Many trigger actions need to access the values of the rows being changed.
- Examples of trigger actions
- Triggers and exceptions
  Exceptions raised by triggers have a statement severity; they roll back the statement that caused the trigger to fire.

Parent topic: Derby server-side programming
Related concepts
Programming database-side JDBC procedures