Good job.
I would probably rework the update statement - I see no reason to execute update statement ten times; a single execution of update statement should solve it.