Universal Database (netDB2) Introductory GuideCreating Views And Selecting DataUniversal Database supports several types of triggers. Triggers can be defined to be activated either before or after a DELETE, INSERT, or UPDATE operation. Each trigger includes a set of SQL statements called a triggered action that can include an optional search condition. Trigger before an INSERT, UPDATE, or DELETE statement to check for certain conditions before performing a triggering operation or to change the input values before they are stored in the table. Wing example illustrates a use of before and after triggers. Consider an application that records and tracks changes to stock prices. The database contains two tables, CURRENTQUOTE and QUOTEHISTORY defined as:
When the QUOTE column of CURRENTQUOTE is updated using a statement such as:
The STATUS column of CURRENTQUOTE should be updated to reflect whether the stock is:
This is done using the following before trigger::wq |