-- INSERT
CREATE trigger tbavaliacao_des_nivel_b02i for tbavaliacao_des_nivel
active before insert position 0
AS
DECLARE VARIABLE HISTORICO VARCHAR(500);
BEGIN

    HISTORICO = '';

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

    IF (HISTORICO <> '') THEN
    BEGIN
        EXECUTE PROCEDURE SPI_HISTORICO('TBAVALIACAO_DES_NIVEL',NEW.id, HISTORICO);
    END
END;