Home

FORALL should be used

Rule description

  • FORALL should be used

 

Non-compliant Code Example

BEGIN
	managerId := Employees.GetManagerByEmployee(:old.EMP_ID);
	for c in c1 loop        --Non compliant code (FORALL should be used)
		UPDATE PRODUCT
			SET MANAGER_ID = managerId
			WHERE c.ID = Id;
    
    end loop;
END;

Compliant Code Example

BEGIN
    
    managerId := Employees.GetManagerByEmployee(:old.EMP_ID);
    forall i IN 1..c1       --Compliant code (FORALL is used)
      UPDATE PRODUCT
        SET MANAGER_ID = managerId
        WHERE iterator(i).ID = Id;
      
END;
Visual Expert 2020
 VEPLSQLRULE73