Home

NCHAR and NVARCHAR2 size in bytes

Rule description

  • NCHAR and NVARCHAR2 size should not be specified in bytes

 

Non-compliant Code Example

DECLARE 
  firstname NVARCHAR2(75 BYTE);         --Non compliant code (NCHAR and NVARCHAR2 size specified in bytes)
  lastname NVARCHAR2(75 BYTE);         --Non compliant code (NCHAR and NVARCHAR2 size specified in bytes)
  landmark NCHAR(75 BYTE);         --Non compliant code (NCHAR and NVARCHAR2 size specified in bytes)

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS;
END;

Compliant Code Example

DECLARE 
  firstname NVARCHAR2(75);          --Compliant code 
  lastname NVARCHAR2(75);           --Compliant code 
  landmark NCHAR(75);               --Compliant code 

BEGIN
	SELECT FIRSTNAME, LASTNAME, LANDMARK 
	INTO firstname,lastname,landmark
	FROM CUSTOMERS;
END;
Visual Expert 2020
 VEPLSQLRULE8