SET TERM ^ ;

CREATE or alter trigger ttbempresa_b02i for tbempresa
active before insert position 2
AS
BEGIN
    IF(CHAR_LENGTH(COALESCE(NEW.NOMEFANTASIA, '')) = 0) THEN
    BEGIN
        NEW.NOMEFANTASIA = SUBSTRING(NEW.RAZAOSOCIAL FROM 1 FOR 19);
    END
END
^

SET TERM ; ^

SET TERM ^ ;

CREATE or alter trigger ttbintegracao_pdv_b01d for tbintegracao_pdv
active before delete position 0
AS
BEGIN
  EXCEPTION "..."'EXCLUSAO NAO PERMITIDA NA TABELA TBINTEGRACAO_PDV. ';
END
^

SET TERM ; ^

