ALTER TABLE TBLOG_RFID_ITEM
    ADD STATUS INTEGER DEFAULT 0 NOT NULL;

COMMENT ON COLUMN TBLOG_RFID_ITEM.STATUS IS
'STATUS DA SINCRONIZACAO PARA RFLOG
0 - NAO ENVIADO;
1 - ENVIADO;';


SET TERM ^ ;

CREATE trigger ttblog_rfid_b01u for tblog_rfid
active before update position 1
AS
BEGIN
    /* SETAR ATUALIZACAO DO EPC */
    IF(NEW.STATUS <> OLD.STATUS) THEN
    BEGIN
        IF(NEW.STATUS = 1) THEN
        BEGIN
            UPDATE TBLOG_RFID_ITEM T SET T.STATUS = 1 WHERE T.LOG_RFID_ID = NEW.ID;
        END
    END
END
^

SET TERM ; ^

