--Order 20011877.60 (SMG148) Special drop-off rail for new and extra inventory items

------------------------SORTADDRESSPERREASONCODE TABLE----------------------------


CREATE TABLE SORTADDRESSPERREASONCODE
(
	REASONCODE_ID        NUMBER NOT NULL ,
	PLANT_ID             NUMBER NOT NULL ,
	SORTADDRESS          VARCHAR2(6) NULL ,
	SYSTEMUSER_ID        NUMBER NOT NULL ,
	TIMESTAMP            DATE NOT NULL 
);


ALTER TABLE SORTADDRESSPERREASONCODE
ADD CONSTRAINT  XPKSORTADDRESSPERREASONCODE PRIMARY KEY (REASONCODE_ID, PLANT_ID);

CREATE  INDEX XIF1SORTADDRESSPERREASONCODE ON SORTADDRESSPERREASONCODE
(REASONCODE_ID   ASC);

ALTER TABLE SORTADDRESSPERREASONCODE
ADD CONSTRAINT SORTADDRESSPERREASONCODE_RCODE FOREIGN KEY (REASONCODE_ID) REFERENCES REASONCODE (REASONCODE_ID) ON DELETE CASCADE;

CREATE  INDEX XIF2SORTADDRESSPERREASONCODE ON SORTADDRESSPERREASONCODE
(PLANT_ID   ASC);

ALTER TABLE SORTADDRESSPERREASONCODE
ADD CONSTRAINT SORTADDRESSPERREASONCODE_PLANT FOREIGN KEY (PLANT_ID) REFERENCES PLANT (PLANT_ID);







