Re: SQL BEFORE puzzle

From: Cimode <cimode_at_hotmail.com>
Date: Tue, 5 Aug 2008 12:16:12 -0700 (PDT)
Message-ID: <81838cb3-ffe0-4467-90cf-9de5f07ed7e1_at_k13g2000hse.googlegroups.com>


On 5 août, 14:35, kschendel <schen..._at_kbcomputer.com> wrote:
> On Aug 4, 4:32 pm, Bob Badour <bbad..._at_pei.sympatico.ca> 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