Home

NULL should not be compared directly

Rule description

  • NULL should not be compared directly

 

Non-compliant Code Example

SELECT
    NAME,
    ADDRESS,
    CREDIT_LIMIT
FROM
    CUSTOMERS
WHERE
	CREDIT_LIMIT <> NULL;       --Non compliant code (Column compared directly with NULL)

Compliant Code Example

SELECT
    NAME,
    ADDRESS,
    CREDIT_LIMIT
FROM
    CUSTOMERS
WHERE
	CREDIT_LIMIT IS NOT NULL;       --Compliant code
Visual Expert 2020
 VEPLSQLRULE56