You don't really want to loop through each row in SQL if it can be avoided.

Row by agonising row (RBAR) is not what SQL is intended for.

Trying to pick apart you code, it looks like you want to insert records based on the cluster_no (which I'm assuming doesn't go up incrementally)

I would suggest something like

[VBA]UPDATE t0

Set t0.cluster_no=M_Rel_Ttemp.Num
FROM (SELECT MAX(cluster_no) AS Num,
wh_acc_no
FROM M_Rel_Ttemp
GROUP BY wh_acc_no) M_Rel_Ttemp
INNER JOIN t0
ON M_Rel_Ttemp.wh_acc_no = tO.wh_acc_no
WHERE M_Rel_Ttemp.Num < t0.cluster_no[/VBA]