Re: SQL BEFORE puzzle

From: Cimode <>
Date: Tue, 5 Aug 2008 12:16:12 -0700 (PDT)
Message-ID: <>

On 5 août, 14:35, kschendel <> wrote:
> On Aug 4, 4:32 pm, Bob Badour <> wrote:
> > I would expect both the BEFORE and AFTER triggers to have a view of both
> > the before and after images of the data. I don't really see the need for
> > before and after triggers. Perhaps I am just missing it.

> I think it's largely for practical reasons.
> An AFTER trigger operates on a row that has already been
> physically placed somewhere in the table/index. If the trigger
> wants to alter a key value, the row probably has to move,
> and you end up with physical storage issues. BEFORE
> triggers avoid this, so they are preferred if part of the
> action is to calculate or update primary or secondary
> key columns.
> Of course this is all implementation dependent, but
> I suspect most implementations would work that way.

The AFTER trigger is a mechanism that can allow non database related operations to be performed independently from the context of a db engine. One may for instance add a line in order table and trigger the transfer of a file to an FTP server. In the absolute they should not be needed but dbms's support for workflow operations is very poor.

Hope this helps. Received on Tue Aug 05 2008 - 21:16:12 CEST

Original text of this message