Trigger Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • soumyasamanta
    New Member
    • Mar 2009
    • 1

    #1

    Trigger Problem

    Please could you help with this. As per the trigger, I am changing the status from 1 to 4 in GLCONTROL, but no data is being inserted into the glcontrol_trigg er table. (No error message).

    Thank you.

    CREATE TRIGGER glcontrol_updat e
    AFTER UPDATE OF status ON glcontrol
    REFERENCING OLD AS OLD_ROW NEW AS NEW_ROW
    FOR EACH ROW MODE DB2SQL
    WHEN (NEW_ROW.status IN (4, 5) AND OLD_ROW.status != 4)
    BEGIN ATOMIC
    MERGE INTO glcontrol_trigg er AS gl_trigger
    USING (SELECT company, fiscal_year, acct_period, r_system,
    je_type, control_group, je_sequence
    FROM glcontrol_trigg er
    WHERE company = NEW_ROW.company and
    fiscal_year = NEW_ROW.fiscal_ year and
    acct_period = NEW_ROW.acct_pe riod and
    r_system = NEW_ROW.r_syste m and
    je_type = NEW_ROW.je_type and
    control_group = NEW_ROW.control _group and
    je_sequence = NEW_ROW.je_sequ ence) AS gl_trigger_exis t
    ON ( gl_trigger.fisc al_year = gl_trigger_exis t.fiscal_year and
    gl_trigger.acct _period = gl_trigger_exis t.acct_period and
    gl_trigger.r_sy stem = gl_trigger_exis t.r_system and
    gl_trigger.je_t ype = gl_trigger_exis t.je_type and
    gl_trigger.cont rol_group = gl_trigger_exis t.control_group and
    gl_trigger.je_s equence = gl_trigger_exis t.je_sequence )
    WHEN NOT MATCHED THEN

    INSERT ( company, fiscal_year, acct_period, r_system, je_type, control_group, je_sequence,
    ld_dtm, run_cycle_num, extract_dtm )
    VALUES ( NEW_ROW.company ,
    NEW_ROW.fiscal_ year,
    NEW_ROW.acct_pe riod,
    NEW_ROW.r_syste m,
    NEW_ROW.je_type ,
    NEW_ROW.control _group,
    NEW_ROW.je_sequ ence,
    current timestamp,
    null,
    null)
    ELSE IGNORE;
    END

    @
Working...