Обсуждение: before/after triggers

Поиск
Список
Период
Сортировка

before/after triggers

От
Dennis Gearon
Дата:
If I have a before trigger on table 'A' modify  table 'B' and an after trigger
on table 'A' fails for that transaction:

1/ Is the change to table 'B' visible to anybody except that tranaction at any time?

2/ Does the change to table 'B' disappear/never show up when the after trigger
fails?

3/ Would all after triggers in that transaction see the change to table 'B'
before the one particular after trigger fails?

4/ do all the major DB's have this functionality? I.E.

    Oracle
    Sybase
    MSSQL (yuck)
    DB2
    <other examples welcome>


Re: before/after triggers

От
Richard Huxton
Дата:
On Wednesday 26 Mar 2003 10:30 pm, Dennis Gearon wrote:
> If I have a before trigger on table 'A' modify  table 'B' and an after
> trigger on table 'A' fails for that transaction:

All triggers take place within a single transaction.

> 1/ Is the change to table 'B' visible to anybody except that tranaction at
> any time?

Shouldn't be. It will never be committed.

> 2/ Does the change to table 'B' disappear/never show up when the after
> trigger fails?

Yes.

> 3/ Would all after triggers in that transaction see the change to table 'B'
> before the one particular after trigger fails?

Should do - they're in the same transaction. See chapter 9.2 of the user guide
"Transaction Isolation" for details

> 4/ do all the major DB's have this functionality? I.E.
>
>     Oracle
>     Sybase
>     MSSQL (yuck)
>     DB2
>     <other examples welcome>

Sorry, can't comment. All should offer similar functionality, but whether the
behaviour is identical I wouldn't want to say without testing.
--
  Richard Huxton