Rule Definition
CHAR should be used for storing fix length character strings. String values will be space padded before stored on disk. If this type is used to store variable length strings, it will waste a lot of disk space.
So, Oracle suggests to use VARCHAR2 / NVARCHAR2 instead of CHAR / NCHAR while declaring datatype.
Also VARCHAR is going to be replaced by VARCHAR2 in future so Oracle recommends to replace VARCHAR by VARCHAR2.
Remediation
Change CHAR columns / variables / parameters to VARCHAR2.
Change VARCHAR columns / variables / parameters to VARCHAR2.
Change NCHAR columns / variables / parameters to NVARCHAR2.
Violation Code Sample
Use Case 1 :
CREATE TABLE leaders
(
lead_name varchar2(12) null,
lead_id char(6) not null,
lead_add varchar2(40) null
)
/
Use Case 2 :
CREATE PROCEDURE remove_leaders (par_lead_name NCHAR(10)) AS
BEGIN
DELETE FROM leaders
WHERE leaders.lead_name = par_lead_name;
END;
/
Fixed Code Sample
Use Case 1 :
CREATE TABLE leaders
(
lead_name varchar2(12) null,
lead_id varchar2(6) not null,
lead_add varchar2(40) null
)
/
Use Case 2 :
CREATE PROCEDURE remove_leaders (par_lead_name NVARCHAR2(10)) AS
BEGIN
DELETE FROM leaders
WHERE leaders.lead_name = par_lead_name;
END;
/
Related Technologies
Technical Criterion
Efficiency - Memory, Network and Disk Space Management
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.