--ABSN-12588 D_UBS_2787 ERP fix to block setting both MBYOP and GLP on PLPC
UPDATE ERP_I_PRODUCTLISTPERCUSTOMER
SET MBYOPPERCENTAGE = 0
WHERE GARMENTLOSS = 'Y' OR GARMENTMAINTENANCE = 'Y';

ALTER TABLE ERP_I_PRODUCTLISTPERCUSTOMER
  ADD CONSTRAINT CHK_ERP_I_PLPC_MBYOPPERCENTAGE3
  CHECK (MBYOPPERCENTAGE = 0 OR (GARMENTLOSS != 'Y' AND GARMENTMAINTENANCE != 'Y'));
  
UPDATE ERP_I_CONTRACTPRODUCT
SET MBYOPPERCENTAGE = 0
WHERE GARMENTLOSS = 'Y' OR GARMENTMAINTENANCE = 'Y';

ALTER TABLE ERP_I_CONTRACTPRODUCT
  ADD CONSTRAINT CHK_ERP_I_CONTRACTPRODUCT_MBYOPPERCENTAGE3
  CHECK (MBYOPPERCENTAGE = 0 OR (GARMENTLOSS != 'Y' AND GARMENTMAINTENANCE != 'Y'));

COMMIT;
