Fujitsu 5.0L10 Server User Manual


 
Update-and-add trigger
For a row added to a database using the INSERT statement or updated using the UPDATE statement, the user can
use a trigger to automatically arrange data of the row into columns. That is, a table updated by an SQL statement that
causes the start of a trigger can be updated in processing of the triggered SQL statement.
For example, the timestamp indicating the time when a column in a row has been updated can be placed in another
column, and the name of the user who updated the row can be placed in another column too. This type of trigger is
called an update-and-add trigger.
Trigger for calling a procedure routine
The user can call a procedure routine by specifying the CALL statement in the triggered SQL statement.
By using the procedure routine, the user can define a procedure that consists of multiple SQL statements as a
triggered SQL statement. In addition, the user can use a trigger to define data integrity and consistency that is
customized according to the user's desired application requirements.
Using triggers can simplify application programs and construct a highly reliable system because the system can
automatically set information in tables and databases as described above.
Sample trigger definitions follow.
Example 1: Simple trigger
If the order price in a row added to the ORDER table exceeds five million, the ORDER_TRIGGER
trigger adds the customer name, product price, and order quantity to the EXPENSIVE_ORDER table.
Sample trigger definition
Operation
44