Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Create a Trigger Function

To define a function as being a trigger function, use the TRIGGER parameter on the FUNCTION command.

...

As an aid to defining new trigger functions LANSA is shipped with the following Application Templates that can be used to form the base of a trigger function:

BBFLDTRIG

Field Level Trigger Function

BBFILTRIG

Table Level Trigger Function

...

  • Understand how triggers are defined and how they should be used by reading the Field Rules/triggers sections and Trigger Functions section.
  • Use options *NOMESSAGES and *MLOPTIMIZE.
  • Options *HEAVYUSAGE and *DBOPTIMIZE may also be considered.
  • Do not directly or indirectly access the database table that the trigger is, or will be, linked to.
  • Where triggers are heavily and constantly invoked avoid resource intensive operations. Such operations will slow down access to the associated table. Whenever reasonable make the trigger "submit" another transaction thus not delaying the source of the event significantly.
  • Recursive implementations may be defined, but will fail to execute correctly. For instance a field trigger function invoked during an insert to table A could attempt to insert data into table B, possibly causing itself to be invoked in a recursive situation, and thus to fail.

...