Informix

Expand all | Collapse all

Trigger Order

  • 1.  Trigger Order

    Posted 4 days ago

    Hi,

    We are running Informix 12.10.FC9W1 on Solaris. We have multiple insert triggers on a table. Is there a way to enforce that the triggers should get executed in a particular order?

    Thank You,

    --Dave 



    ------------------------------
    Dave Baligo
    ------------------------------


  • 2.  RE: Trigger Order

    Posted 4 days ago
    I've never testing this, but I strongly suspect that triggers are fired in the order they are created, ie they are selected from systriggers ORDER BY trigid ...

    Easy enough to test. Create two update triggers on different column on a table that write to a logging table that has a serial column so that the record written identifies which trigger it was that wrote it. Then try adding the two triggers in different orders and see what happens.

    ------------------------------
    Art Kagel
    ------------------------------



  • 3.  RE: Trigger Order

    Posted 4 days ago
    The order of the execution is undetermined. You can find what it is today, but that doesn't mean it won't change in the future. Customers cannot assume any specific order.
    If you have a set of actions you want to execute than create a stored procedure and execute it on a trigger.
    There is not reasonable rationale to assume a certain order on independent triggers.
    If the actions are dependent then they should be executed together.

    Regards.

    ------------------------------
    FERNANDO NUNES
    ------------------------------



  • 4.  RE: Trigger Order

    Posted 4 days ago
    Excellent point Fernando!

    ------------------------------
    Art Kagel
    ------------------------------



  • 5.  RE: Trigger Order

    Posted 4 days ago

    I would consolidate them down to one trigger/trigger and stored procedure that does the steps you want in the correct order.

     I think the original post is included.  I'm posting from the website and it's kind of hazy as to what happens when you do that.

                            --EEM



    ------------------------------
    Everett E Mills
    ------------------------------



  • 6.  RE: Trigger Order

    Posted 4 days ago
    Thank you all for the input and suggestions.

    Have a great day,

    --Dave

    ------------------------------
    Dave Baligo
    ------------------------------