--Order 20013413

CREATE TABLE SCRUTINYCHECK
(
	PLANT_ID             NUMBER NOT NULL ,
	CHECK1               NUMBER NOT NULL  CONSTRAINT  Check1_valid1_1 CHECK (CHECK1 IN (0, 1)),
	CHECK2               NUMBER NOT NULL  CONSTRAINT  Check2_valid1_1 CHECK (CHECK2 IN (0, 1)),
	CHECK3               NUMBER NOT NULL  CONSTRAINT  Check3_valid1_1 CHECK (CHECK3 IN (0, 1)),
	CHECK4               NUMBER NOT NULL  CONSTRAINT  Check4_valid1_1 CHECK (CHECK4 IN (0, 1)),
	CHECK5               NUMBER NOT NULL  CONSTRAINT  Check5_valid1_1 CHECK (CHECK5 IN (0, 1)),
	CHECK6               NUMBER NOT NULL  CONSTRAINT  Check6_valid1_1 CHECK (CHECK6 IN (0, 1)),
	CHECK7               NUMBER NOT NULL  CONSTRAINT  Check7_valid1_1 CHECK (CHECK7 IN (0, 1)),
	CHECK8               NUMBER NOT NULL  CONSTRAINT  Check8_valid1_1 CHECK (CHECK8 IN (0, 1)),
	CHECK9               NUMBER NOT NULL  CONSTRAINT  Check9_valid1_1 CHECK (CHECK9 IN (0, 1)),
	CHECK10              NUMBER NOT NULL  CONSTRAINT  Check10_valid1_1 CHECK (CHECK10 IN (0, 1))
);

COMMENT ON COLUMN SCRUTINYCHECK.CHECK1 IS '0 – Not to perform check
1 - Perform check
Customer is excluded from Scrutiny
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK2 IS '0 – Not to perform check
1 - Perform check
Check if all unloaded Bags are sorted
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK3 IS '0 – Not to perform check
1 - Perform checkNominal 
Stock is below a predefined quantity
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK4 IS '0 – Not to perform check
1 - Perform check
Negative Delivery Variation Lines
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK5 IS '0 – Not to perform check
1 - Perform check
Delivery Variation with Reason Code Exclude from Scrutiny
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK6 IS '0 – Not to perform check
1 - Perform check
Missing Products
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK7 IS '0 – Not to perform check
1 - Perform check
Average and Deviation and Nominal
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK8 IS '0 – Not to perform check
1 - Perform check
Dry Cleaning
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK9 IS '0 – Not to perform check
1 - Perform check
Heavy Soil
';

COMMENT ON COLUMN SCRUTINYCHECK.CHECK10 IS '0 – Not to perform check
1 - Perform check
Clean Return
';

ALTER TABLE SCRUTINYCHECK
ADD CONSTRAINT  XPKSCRUTINYCHECK PRIMARY KEY (PLANT_ID);

ALTER TABLE SCRUTINYCHECK
ADD CONSTRAINT SCRUTINYCHECK_PLANT FOREIGN KEY (PLANT_ID) REFERENCES PLANT (PLANT_ID);