Results 1 to 2 of 2

Thread: Before Trigger

  1. #1
    Join Date
    Feb 2004
    Posts
    107

    Unanswered: Before Trigger

    hi friends,

    I am thinking of the real time need for the before trigger. I guess whatever that can be done in the 'Before' trigger can be moved to the 'After' trigger itself. I couldn't find any special need for the 'Before' trigger.
    Please let me know if there is some real use of 'Before' trigger, i.e. one logic which can only be done in 'Before' trigger and that can't be moved to 'After' trigger.

    I'm referring to DB2/UDB.

    Jake

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

    Re: Before Trigger

    The main reason to use a 'Before' trigger is to reset a value for a column prior to DB2 committing the data to a table. On my project, I use before triggers to set a status column based on data existing in another table.

    With 'Before' triggers you cannot use DML statements (INSERT/UPDATE), you can only use SET. That is the may difference when deciding 'before' or 'after'.

    Originally posted by Jake K
    hi friends,

    I am thinking of the real time need for the before trigger. I guess whatever that can be done in the 'Before' trigger can be moved to the 'After' trigger itself. I couldn't find any special need for the 'Before' trigger.
    Please let me know if there is some real use of 'Before' trigger, i.e. one logic which can only be done in 'Before' trigger and that can't be moved to 'After' trigger.

    I'm referring to DB2/UDB.

    Jake

Posting Permissions

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