CREATE OR REPLACE TRIGGER ERX.OB_NCPDP_MSG_HIST_TRG 
    BEFORE INSERT OR UPDATE ON ERX.OUTBOUND_NCPDP_MSG_HIST 
    FOR EACH ROW 
BEGIN 
IF UPDATING THEN
  :NEW.UPDATED_DATE := SYSDATE;
ELSE
  :NEW.CREATED_DATE := SYSDATE;
   IF :NEW.OUTBOUND_NCPDP_MSG_HIST_ID IS NULL THEN
   :NEW.OUTBOUND_NCPDP_MSG_HIST_ID := OB_NCPDP_MSG_HIST_ID_SEQ.NEXTVAL;
   END IF;
END IF;
END; 
/


