Subject Re: After update trigger: the same values for new.somefiled and old.somefield
Author
Hi guys,

thanks for the suggestions and ideas, it helped to track it down.

It was not directly another trigger or procedure updating the record in question, but something similar :

I had altered an existing trigger. There was an if-block checking a field A for being not null and executing some code. I'd placed the new code inside of this if-block as I was sure, that the field A can't be null at this point and if it is, the new code doesn't need to be executed anyway. This wasn't correct though, because I'm setting this field A in my application in the AfterPost event of the dataset. So what happened was:
- first post (= after update trigger execution): my "somefield" (part of the new code) has actually changed, but the field A was still null -> no new code execution at all
- second post (= after update trigger): field A was not null anymore, but also my "somefield" (part of the new code) had the same new value in the new. and old. variables already -> no new code execution for the old value

Somehow I've thought that an after update trigger only fires once when all the changes have been made and comitted.

Placing the new code outside of the existing if-block works fine now. Thank you all for the help!