ALTER TABLE M_parts ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER M_parts_trigger
   BEFORE UPDATE ON M_parts
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/

ALTER TABLE M_workorder ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER M_workorder_trigger
   BEFORE UPDATE ON M_workorder
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/

ALTER TABLE S_supplier ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER S_supplier_trigger
   BEFORE UPDATE ON S_supplier
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE S_supp_component ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER S_supp_component_trigger
   BEFORE UPDATE ON S_supp_component
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE S_purchase_order ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER S_purchase_order_trigger
   BEFORE UPDATE ON S_purchase_order
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE S_purchase_orderline ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER S_purchase_orderline_trigger
   BEFORE UPDATE ON S_purchase_orderline
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE C_discount ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER C_discount_trigger
   BEFORE UPDATE ON C_discount
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE C_rule ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER C_rule_trigger
   BEFORE UPDATE ON C_rule
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/
ALTER TABLE C_customer ADD (oc_version NUMBER DEFAULT 0);
CREATE TRIGGER C_customer_trigger
   BEFORE UPDATE ON C_customer
   FOR EACH ROW
   WHEN (new.oc_version = old.oc_version)
DECLARE
BEGIN
   :NEW.oc_version := :OLD.oc_version + 1;
END;
/

