Home

Variables should be nullable

Rule description

  • Variables should be nullable

 

Non-compliant Code Example

DECLARE 
  firstname VARCHAR(75) NOT NULL;           --Non compliant code (Variable is not null-able)
  lastname VARCHAR(75);
  landmark NVARCHAR2(75) NOT NULL;          --Non compliant code (Variable is not null-able)

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS
	WHERE (CREDIT_LIMIT = 1800 AND CREDIT_LIMIT > 1100);
END;

Compliant Code Example

DECLARE 
  firstname VARCHAR(75);           --Compliant code (Variable is null-able)
  lastname VARCHAR(75);
  landmark NVARCHAR2(75);          --Compliant code (Variable is null-able)

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS
	WHERE (CREDIT_LIMIT = 1800 AND CREDIT_LIMIT > 1100);
END;
Visual Expert 2020
 VEPLSQLRULE70