Versions Compared

Key

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

...

ACME Engineering run a payroll system.

The Employee Master table (EMPL) contains two columns called "SALARY" and "WEEKPAY".

...

For a new employee the WEEKPAY calculation is relatively simple, but when an employee's SALARY is changed the complex calculation involves both the new SALARY figure and the previous SALARY figure.

The Trigger Function

The first step in defining the trigger is to define the trigger function that encapsulates all the WEEKPAY rules into one and only one place.

...

Code Block
         SALARY    NEP   SALARY 
i.e.      salary is not equal to previous salary

 
which Which says that the trigger should be activated "BEFORE UPDATE" but only if the employee's SALARY has changed.

...