--ABS-116377
ALTER TABLE STOCKROOM ADD (USEWORKORDERPICKING VARCHAR2(1) NULL CONSTRAINT CHK_STOCK_USEWOPICK CHECK (USEWORKORDERPICKING IN ('Y','N')));

COMMENT ON COLUMN STOCKROOM.USEWORKORDERPICKING
  IS 'Attribute used to overrule SystemSetting UseWorkOrderPicking on Plant level';

UPDATE STOCKROOM ST
SET USEWORKORDERPICKING = (SELECT SS.VALUE FROM SYSTEMSETTING SS WHERE SS.NAME = 'USEWORKORDERPICKING' AND SS.PLANT_ID = (SELECT BU.PLANT_ID FROM BUSINESSUNIT BU WHERE BU.BUSINESSUNIT_ID = ST.MANAGEDBYBU_ID));

COMMIT;

ALTER TABLE STOCKROOM MODIFY (USEWORKORDERPICKING VARCHAR2(1) NOT NULL);

