Subject | Re: [firebird-support] update a field in after insert update |
---|---|
Author | Ann W. Harrison |
Post date | 2009-03-14T21:46:03Z |
Maurizio,
In case it wasn't absolutely clear, you can't change a value
in an after insert trigger by straight forwardly updating
new.<fieldname>. After action triggers happen -- oddly enough --
after the action. Earlier versions of Firebird accepted those
assignments and quietly dropped them on the floor. More modern
versions will produce an error if you attempt to assign a value
to the target row in an after action trigger.
If the change must actually be done after the insert occurs,
you could try something like this:
update test_table s
set s.kyriga = 'test'
where s.<primary key> = new.<primary key>
replacing <primary key> with the name of the primary key field.
Good luck,
Ann
In case it wasn't absolutely clear, you can't change a value
in an after insert trigger by straight forwardly updating
new.<fieldname>. After action triggers happen -- oddly enough --
after the action. Earlier versions of Firebird accepted those
assignments and quietly dropped them on the floor. More modern
versions will produce an error if you attempt to assign a value
to the target row in an after action trigger.
If the change must actually be done after the insert occurs,
you could try something like this:
update test_table s
set s.kyriga = 'test'
where s.<primary key> = new.<primary key>
replacing <primary key> with the name of the primary key field.
Good luck,
Ann