Re: Protect record from deletion via trigger

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: Tue, 1 Jul 2008 23:52:40 -0700 (PDT)
Message-ID: <e0e69fcc-6624-47fa-9a96-fabe78b58af7@d19g2000prm.googlegroups.com>


On Jul 2, 1:09 am, hpuxrac <johnbhur..._at_sbcglobal.net> wrote:
> On Jul 1, 4:10 pm, DA Morgan <damor..._at_psoug.org> wrote:
>
>
>
> > hpuxrac wrote:
> > > Tom Kyte says ( and I believe him ) "Triggers are evil" ... therefore
> > > don't use them at all or at least minimize their usage.
>
> > If you are going to quote Tom, and he did say it, then quote him in
> > context:
>
> > Responding to the statement:
> > "Protecting data integrity is paramount,"
>
> > Tom wrote:
>
> > "indeed it is, that is why triggers are evil :)
>
> > Most of the time, "business logic"/"data logic" that is implemented in
> > triggers is done incorrectly (that is what I mean by people abuse
> > triggers)."
>
> >http://tkyte.blogspot.com/2006/09/classic-example-of-why-i-despise.html
>
> > It is not the triggers that are the issue ... it is poor implementations
> > with triggers. There is a time and place for triggers. And when used
> > correctly they can be the best solution possible.
>
> snip
>
> As usual you are off base way off.  Tom would like to see triggers
> totally removed from oracle ...
>
> How many times did he say "triggers are evil" this year at NEOOUG?  I
> would guess at least 20 times.
>
> Wonder what remark he signed books with this year?  Even you might be
> able to guess ...

From that blog post I'd say that Tom is against the triggers not because they are universally and unambiguously evil, but because a lot of people don't really understand how they work and when it's appropriate or inappropriate to use them and therefore often abuse them or implement them incorrectly. And because incorrect use of triggers leads to all sorts of hard to troubleshoot problems, he'd rather remove them altogether than regularly deal with consequences of their abuse. How many times did you answer the same question: "How do I enforce the order of execution of multiple triggers of the same kind on the same table because I need them to be executed in particular order?", and what your answer was? Oracle seem to have been bothered with it so often they even went as far as to implement declarative trigger execution ordering in 11g. :)

And did you notice that the second evil thing he'd like to be gone is autonomous transactions? I remember the time when Tom was fascinated by it. :) Actually, it's very cool feature, but regrettably it, too, is being abused way too often.

My $0.02,

   Vladimir M. Zakharychev
   N-Networks, makers of Dynamic PSP(tm)    http://www.dynamicpsp.com Received on Wed Jul 02 2008 - 01:52:40 CDT

Original text of this message