• Maybe I'm not seeing a complexity you know about. I would write the update to over the whole table and just run it once. I don't see the need to run it for each case individually. Can you provide some DDL and sample data that takes the various situations you have into account?