SQL BEFORE puzzle -
07-31-2008
, 11:18 AM
This is not a theory question by any means, but perhaps there is someone
hanging out here who is able to speak with authority on SQL. We are
trying to figure out the justification for why a BEFORE trigger should
be prevented from doing any updates. The wording we're looking at from
the standard is:
"If the trigger is a BEFORE trigger and if, before the completion of the
execution of any <SQL procedure statement> simply contained in triggered
SQL statements, an attempt is made to execute an SQL-data change
statement or an SQL-invoked routine that possibly modifies SQL-data,
then an exception condition is raised: prohibited statement encountered
during trigger execution."
Obviously one shouldn't expect to be able to update a row that doesn't
exist yet, but why prevent all updates (to other rows, other tables)?
--
Roy |