Updating tables within cursor loop