--Order 20015191

---CUSTOMER table---

ALTER TABLE CUSTOMER
	ADD (LOSSCHARGETRIGGER NUMBER  DEFAULT 0 NOT NULL);

COMMENT ON COLUMN CUSTOMER.LOSSCHARGETRIGGER IS '0=Loss Triggered by Outscan Date 
1=Loss Triggered by Last Scan Date';


---UNIQUEITEMLOSS table---

ALTER TABLE UNIQUEITEMLOSS
	ADD (LOSSCHARGETRIGGER NUMBER NULL);

ALTER TABLE UNIQUEITEMLOSS
	ADD (LASTSCANDATE DATE NULL);

COMMENT ON COLUMN UNIQUEITEMLOSS.LOSSCHARGETRIGGER IS 'null or 0=Loss Triggered by Outscan Date 
1=Loss Triggered by Last Scan Date
';

CREATE INDEX XIE5UNIQUEITEMLOSS on UNIQUEITEMLOSS (UNIQUEITEM_LINK_ID, TRUNC(LASTSCANDATE));

DROP INDEX XIE2UNIQUEITEMLOSS;
CREATE INDEX XIE2UNIQUEITEMLOSS on UNIQUEITEMLOSS (UNIQUEITEM_LINK_ID, TRUNC(OUTSCANDATE));