Home

All branches in a conditional structure should not have exactly the same implementation

Rule description

  • All branches in a conditional structure should not have exactly the same implementation

 

Non-compliant Code Example

SELECT OrderID, Quantity,
CASE
    WHEN Quantity > 30 THEN 'The quantity is greater than 30'
    WHEN Quantity > 40 THEN 'The quantity is greater than 30' --Non compliant code (When clause is having same implementation as of above condition)
    WHEN Quantity = 30 THEN 'The quantity is 30'
    ELSE 'The quantity is under 30'
END AS QuantityText
FROM OrderDetails;
Visual Expert 2020
 VETSQLRULE14