CREATE TRIGGER TTBPDV_CFE_B02I FOR TBPDV_CFE
ACTIVE BEFORE INSERT POSITION 2
AS
BEGIN

  IF(COALESCE(NEW.REPRESENTANTE_ID, 0) = 0) THEN
  BEGIN
      NEW.REPRESENTANTE_ID = FN_PARAMETRO('SISTEMA.REPRESENTANTE_PADRAO');
  END
END;