Database trigger: Can we have more than one trigger program

Posted by rolguin on 04-Apr-2013 09:24


   We have a system from a Third Part.

   At the dictionary, for a particular table there is already a program for WRITE event. We can't amend that existing program and also we don't want that.

   Is there any way to put a second trigger program for the same event, please?



All Replies

Posted by Dileep Dasa on 05-Apr-2013 00:40

There is an option called "Overridable" to override a trigger procedure. This allows one to put a second trigger program for the same event.

Posted by Patrick Tingen on 05-Apr-2013 06:46

You could add an extra directory at the front of your propath, place your own trigger there and call the already existing one from within your own trigger.

Another option is to use a session trigger. In your startup program do something along the lines of:

ON WRITE OF customer NEW new-cust OLD old-cust


  IF <> AND

     new-cust.postal-code = old-cust.postal-code


      MESSAGE "Must update postal code, too.".




Posted by Peter van Dam on 07-Apr-2013 10:35

Depending on what you want to do: if you don't need to change data you could add a replication trigger.

Posted by cverbiest on 18-Apr-2013 04:14

AFAIK you can change data in a replication trigger, though I would not recommend it as the normal trigger does not fire again.

In a tech support case a while ago we, the support engineer and I, came to the following conclusion regarding difference between normal and replication triggers

The replication version of a db trigger is not different from the normal trigger except for the following
1. It is meant to be used for replication but this is not enforced by the 4GL
2. You can disable the normal triggers without disabling the replication triggers but not vice-versa
3. You cannot create a session replication trigger
4. It executes after the normal trigger
The replication trigger executes as frequently as the normal trigger unless the normal trigger returns error.

This thread is closed