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 complaint code (NCHAR and NVARCHAR2 size specified in bytes)
  lastname NVARCHAR2(75 BYTE);         --Non complaint code (NCHAR and NVARCHAR2 size specified in bytes)
  landmark NCHAR(75 BYTE);         --Non complaint 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);          --Complaint code 
  lastname NVARCHAR2(75);           --Complaint code 
  landmark NCHAR(75);               --Complaint code 

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