A forms trigger is a block of PL/SQL code that adds functionality to your
application. Triggers are attached to objects in your application. When a
trigger is fired it executes the code it contains. Each trigger s name defines
what event will fire it; for instance a WHEN-BUTTON-PRESSED trigger executes
its code each time you click on the button to which the trigger is attached. Or
we can say a forms trigger is a set of PL/SQL actions that happen each time an
event such as when-checkbox-changed when-button-pressed or
when-new-record-instance occurs. You can attach several triggers to a data
query. The most popular of them are the PRE-QUERY and POST-QUERY.
PRE-QUERY and POST-QUERY trigger
The PRE-QUERY trigger fires before the select statement is finalized. The
POST-QUERY trigger fires before selected records are presented to the user. It
fires after records are retrieved but before they are displayed. So you can use
it to enhance a query s records in a number of ways. Your Post-Query trigger can
contain code to calculate or populate control items.
PRE-INSERT and WHEN-NEW-FORM-INSTANCE trigger
Some other useful triggers are: PRE-INSERT and WHEN-NEW-FORM-INSTANCE.
A PRE-INSERT trigger fires once before each new record is inserted in a commit
process. The "WHEN-NEW-FORM-INSTANCE" trigger will be used to prepare objects or
an action when entering to a new form. It fires when the form is entered.