Field Level Triggers - IBM AS400

This is a discussion on Field Level Triggers - IBM AS400 ; Can I add a trigger such that it fires only when a certain field, or fields is changed? Thanks, Sam...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Field Level Triggers

  1. Field Level Triggers

    Can I add a trigger such that it fires only when a certain field, or fields
    is changed?

    Thanks, Sam



  2. Re: Field Level Triggers

    On 31 Mai, 02:34, "Saml" wrote:
    > Can I add a trigger such that it fires only when a certain field, or fields
    > is changed?
    >
    > Thanks, Sam


    Yes, SQL allows field level triggers.

    Example:
    CREATE TRIGGER MySchema/TriggerName
    AFTER UPDATE OF MyColumn ON MySchema/MyTable
    REFERENCING OLD O NEW N
    FOR EACH ROW
    MODE DB2ROW
    WHEN ( search-condition )
    BEGIN ATOMIC
    -- Do Whatever you want
    END;

    Birgitta


+ Reply to Thread