-- ABS-77511 / ABS-78286
-----PACKINGNOTE TABLE----
DECLARE
BEGIN
	EXECUTE IMMEDIATE 'ALTER TABLE PACKINGNOTE ADD (STANDARDDELIVERYINCLUDED NUMBER NULL CONSTRAINT STDDELIVERYINCLUDED_VALID1 CHECK (STANDARDDELIVERYINCLUDED IN (NULL,1)))';
EXCEPTION
	WHEN OTHERS THEN
		NULL;
END;
/
	
COMMENT ON COLUMN PACKINGNOTE.STANDARDDELIVERYINCLUDED IS
'Indicates if packing note was generated based upon any standard deliveries to avoid that they are used more than once to generate a packing note for a given date 
1 = Stand deliveries included';										  

DECLARE
BEGIN
	EXECUTE IMMEDIATE 'CREATE INDEX XIE17PACKINGNOTE ON PACKINGNOTE (NVL(STANDARDDELIVERYINCLUDED,0) ASC)';
EXCEPTION
	WHEN OTHERS THEN
		NULL;
END;
/

