--ABS-170126
--first set GARMENTLOSSPERCENTAGE to default 100

UPDATE PLPCBUDGETPROTECTION
SET    GARMENTLOSSPERCENTAGE = 100
WHERE  GARMENTLOSSPERCENTAGE = 0;
COMMIT;
 
UPDATE CONTRACTPRODUCTBGPROTECTION
SET    GARMENTLOSSPERCENTAGE = 100
WHERE  GARMENTLOSSPERCENTAGE = 0;
COMMIT;

ALTER TABLE PLPCBUDGETPROTECTION
  ADD CONSTRAINT CHK_PLPCBUDGETPR_GRMLOSSPERC2
  CHECK (GARMENTLOSS = 'N' OR (GARMENTLOSS = 'Y' AND GARMENTLOSSPERCENTAGE > 0));

ALTER TABLE CONTRACTPRODUCTBGPROTECTION
  ADD CONSTRAINT CHK_CONTRACTPRODBG_GARMEMB2
  CHECK (GARMENTLOSS = 'N' OR (GARMENTLOSS = 'Y' AND GARMENTLOSSPERCENTAGE > 0));
