If the Result is 0 and the Weight is < 5 then the Weight of that KPI must be divided into the KPI's where the Perf_KPA_ID is the same and the result is not 0 and the Weight of that KPI must become 0

If the Result is 0 and the Weight is > 5 then the Weight of that KPI must be divided into all the KPI's where the Emp_ID is the same in this case EMP1 and the result of any KPI's in that KPA_KPI table is not 0 and the Weight of that KPI must become 0