create or replace TRIGGER LOG_ORE_ALTPROPOSTA
BEFORE DELETE OR INSERT OR UPDATE
ON PROPCOMERCIAL FOR EACH ROW
DECLARE 
   V_CDOPERADOR VARCHAR2(10);
   V_DTOPERACAO DATE;
   V_NMTABELA   VARCHAR2(30);
   V_IDOPERACAO VARCHAR2(10);
BEGIN
   IF INSERTING THEN
      V_CDOPERADOR := :NEW.CDOPERADOR;
      V_DTOPERACAO := SYSDATE;
      V_NMTABELA   := 'PROPCOMERCIAL';
      V_IDOPERACAO := 'INSERT';
   ELSIF UPDATING THEN
      V_CDOPERADOR := :NEW.CDOPERADOR;
      V_DTOPERACAO := SYSDATE;
      V_NMTABELA   := 'PROPCOMERCIAL';
      V_IDOPERACAO := 'UPDATE';
   ELSIF DELETING THEN
      V_CDOPERADOR := NULL;
      V_DTOPERACAO := SYSDATE;
      V_NMTABELA   := 'PROPCOMERCIAL';
      V_IDOPERACAO := 'DELETE';
   END IF;
   INSERT INTO LOGALTCONTPROP (CDOPERADOR, DTOPERACAO, NMTABELA, IDOPERACAO)
   VALUES (V_CDOPERADOR, V_DTOPERACAO, V_NMTABELA, V_IDOPERACAO);
END;
/