SET TERM ^ ;

CREATE trigger ttbmodelo_kit_b09i for tbmodelo_kit
active before insert position 9
AS
declare variable HISTORICO VARCHAR(500);
begin
    HISTORICO = '';

    IF(NEW.ID > 0) THEN
    BEGIN
        HISTORICO = HISTORICO||'REGISTRO INCLUIDO';
    END

    IF(HISTORICO <> '') THEN
    BEGIN
        EXECUTE PROCEDURE SPI_HISTORICO('TBMODELO_KIT', NEW.ID, HISTORICO);
    END
end
^

SET TERM ; ^

SET TERM ^ ;

CREATE trigger ttbmodelo_kit_b09d for tbmodelo_kit
active before delete position 9
AS
declare variable HISTORICO VARCHAR(500);
begin
    HISTORICO = '';

    IF(OLD.ID > 0) THEN
    BEGIN
        HISTORICO = HISTORICO||'REGISTRO EXCLUÍDO';
    END

    IF(HISTORICO <> '') THEN
    BEGIN
        EXECUTE PROCEDURE SPI_HISTORICO('TBMODELO_KIT', OLD.ID, HISTORICO);
    END
end


^

SET TERM ; ^

