Results 1 to 3 of 3

Thread: After Triggers

  1. #1
    Join Date
    Feb 2004
    Posts
    4

    Unanswered: After Triggers

    Hi, I have a quick quesiton about after triggers. I want to fire a trigger after a value has been added into a column named 'crime' in table 'work'. When this value has been entered, the trigger must add the contents of the record into a table named 'crimelog', can anyone help?

  2. #2
    Join Date
    Jul 2003
    Location
    Austin, TX, USA
    Posts
    278

    After Trigger

    Hi,

    The after trigger will suit your purpose. Just write a logic to be implemented after insert or update on table 1 for each row. Do the necessary action.

    Hope you did not want the code only a confirmation if it's possible or not.

    Cheers

    Nitin.
    HTH

    Nitin

    Ask the experienced rather than the learned

  3. #3
    Join Date
    Aug 2003
    Location
    Massachusetts, USA
    Posts
    106

    Re: After Triggers

    An example:

    CREATE TRIGGER somename
    AFTER UPDATE OF crime ON work
    REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL
    WHEN ( n.crime IS NOT NULL OR COALESCE(n.crime,'null') <> COALESCE(o.crime,'null') )
    BEGIN ATOMIC

    post to other table

    END
    @

    Originally posted by English_Bloke82
    Hi, I have a quick quesiton about after triggers. I want to fire a trigger after a value has been added into a column named 'crime' in table 'work'. When this value has been entered, the trigger must add the contents of the record into a table named 'crimelog', can anyone help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •