Home
Constraints should not be applied to types that cannot be constrained
Rule description
- Constraints should not be applied to types that cannot be constrained
Non-compliant Code Example
Create TABLE EMPLOYEE
(
EMP_ID number(10) NOT NULL,
FIRSTNAME NVARCHAR2(75),
LASTNAME NVARCHAR2(75),
DEPT_ID int,
ADDRESS NVARCHAR2(250) NOT NULL,
Photo blob(300), --Non compliant code
CONSTRAINT employee_pk PRIMARY KEY (EMP_ID)
);
Compliant Code Example
Create TABLE EMPLOYEE
(
EMP_ID number(10) NOT NULL,
FIRSTNAME NVARCHAR2(75),
LASTNAME NVARCHAR2(75),
DEPT_ID int,
ADDRESS NVARCHAR2(250) NOT NULL,
Photo blob(), --Compliant code
CONSTRAINT employee_pk PRIMARY KEY (EMP_ID)
);