CREATE OR REPLACE TRIGGER ATUALIZA_CDRASTRITM_ITEMSOLI
BEFORE INSERT
ON ITEMSOLI FOR EACH ROW
DECLARE

  V_CDRASTRITM NUMBER;
  V_CDRASTRITMAUX VARCHAR2(20);
  V_DSREMOTEADDR VARCHAR2(15);
  V_DSREMOTEHOST VARCHAR2(15);
  V_DSSERVERRDM  VARCHAR2(20);
  V_DSSERVMETHOD VARCHAR2(30);
  V_DSREMOTEOPER VARCHAR2(12);

BEGIN
   WEBTUNNING(V_DSREMOTEADDR,
              V_DSREMOTEHOST,
              V_DSSERVERRDM,
              V_DSSERVMETHOD,
              V_DSREMOTEOPER);
   IF :NEW.CDRASTRITM IS NULL THEN
      NOVO_CODIGO_SC('CDRASTRITM', V_CDRASTRITMAUX);
      V_CDRASTRITM := TO_NUMBER(SUBSTR(V_CDRASTRITMAUX,11,10));
      :NEW.CDRASTRITM  := V_CDRASTRITM;
   END IF;
END;
/

-- VERSAO --
BEGIN ATUVEROBJ('ATUALIZA_CDRASTRITM_ITEMSOLI','5.60.XXX'); END;
/