Subject | Before Insert or After Insert trigger? |
---|---|
Author | Luigi Siciliano |
Post date | 2018-09-06T06:53:21Z |
Hallo,
I have an After Insert/Update trigger for a table to update another
table like this:
<snip>
if (NEW.AGGIORNA_CONDIZIONI = 1) then
begin
update
ARTICOLI_CONDIZIONI_CLIENTI ACC
SET
<snip>
end
else if ...
<snip>
Now I need to set a fields in the same table like this to track the
updates performed:
CONDIZIONI_AGGIORNATE = NEW.AGGIORNA_CONDIZIONI,
AGGIORNA_CONDIZIONI = 0 /* no conditions to update */
To do this I must change from After Insert/Update trigger in Before
Insert/Update trigger.
Is this safe or I must do other behaviour?
Updating another table from a Before trigger is made in a transaction
that rolling back if exception occurs?
Thanks.
--
Luigi Siciliano
--------------------------
I have an After Insert/Update trigger for a table to update another
table like this:
<snip>
if (NEW.AGGIORNA_CONDIZIONI = 1) then
begin
update
ARTICOLI_CONDIZIONI_CLIENTI ACC
SET
<snip>
end
else if ...
<snip>
Now I need to set a fields in the same table like this to track the
updates performed:
CONDIZIONI_AGGIORNATE = NEW.AGGIORNA_CONDIZIONI,
AGGIORNA_CONDIZIONI = 0 /* no conditions to update */
To do this I must change from After Insert/Update trigger in Before
Insert/Update trigger.
Is this safe or I must do other behaviour?
Updating another table from a Before trigger is made in a transaction
that rolling back if exception occurs?
Thanks.
--
Luigi Siciliano
--------------------------