--- ABS-10115
-------------------------   REASONCODE   -----------------------------
ALTER TABLE REASONCODE 
ADD(CORRECTDELIVERYHISTORY VARCHAR2(1) DEFAULT 'Y' NOT NULL
CONSTRAINT YN_VALIDATIONFIELD254 CHECK (CORRECTDELIVERYHISTORY IN ('Y','N')));


--------------------------   REASONCODEDIALOGS   ----------------------
INSERT INTO REASONCODEDIALOGS
(SELECT R.REASONCODE_ID,
	(SELECT D.DIALOG_ID FROM DIALOGS D WHERE D.CODE='CorrectionTicket'),
	'Y',
	GETMINSYSTEMUSER(),
	TIMESTAMP
FROM REASONCODE R);
COMMIT;
	

-------------------------   PACKINGNOTE   ----------------------------
ALTER TABLE PACKINGNOTE 
ADD(CORRECTIONREASONCODE_ID NUMBER NULL);

CREATE INDEX XIF10PACKINGNOTE ON PACKINGNOTE (CORRECTIONREASONCODE_ID);

ALTER TABLE PACKINGNOTE 
ADD CONSTRAINT PACKINGNOTE_REASONCODECORR FOREIGN KEY (CORRECTIONREASONCODE_ID) REFERENCES REASONCODE(REASONCODE_ID) ON DELETE SET NULL;