Home

WHERE clause conditions should not be contradictory

Rule description

  • WHERE clause conditions should not be contradictory

 

Non-compliant Code Example

DECLARE 
  firstname NVARCHAR2(75);
  lastname NVARCHAR2(75);
  landmark NVARCHAR2(75);          

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS
	WHERE (CREDIT_LIMIT = 1800 AND CREDIT_LIMIT > 1100);    --Non compliant code (WHERE clause with the contradictory conditions)
END;

Compliant Code Example

DECLARE 
  firstname NVARCHAR2(75);
  lastname NVARCHAR2(75);
  landmark NVARCHAR2(75);          

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS
	WHERE CREDIT_LIMIT > 1100;    --Compliant code (WHERE clause withouts the contradictory conditions)
END;
Visual Expert 2020
 VEPLSQLRULE52