CREATE TRIGGER TTBMATRIZ_B01I FOR TBMATRIZ
ACTIVE BEFORE INSERT POSITION 9
AS
declare variable historico varchar(500);
BEGIN
  historico = '';
  IF(NEW.CODIGO > 0) then
  BEGIN
    historico = historico||' Reg.Incluido';
  END

  IF(HISTORICO <> '') then
  BEGIN
    execute procedure spi_historico('TBMATRIZ',NEW.CODIGO,historico);
  END
END;

CREATE TRIGGER TTBMATRIZ_B02D FOR TBMATRIZ
ACTIVE BEFORE DELETE POSITION 9
AS
declare variable historico varchar(500);
BEGIN
  historico = '';
  IF(OLD.CODIGO > 0) then
  BEGIN
    historico = historico||' Reg.Excluido';
  END

  IF(HISTORICO <> '') then
  BEGIN
    execute procedure spi_historico('TBMATRIZ',OLD.CODIGO,historico);
  END
END;
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           
                                           