CREATE TABLE TBLOG_RFID_ITEM (
    ID INTEGER NOT NULL,
    LOG_RFID_ID INTEGER,
    EPC VARCHAR(500),
    DATAHORA TIMESTAMP DEFAULT LOCALTIMESTAMP NOT NULL);

ALTER TABLE TBLOG_RFID_ITEM
ADD CONSTRAINT PK_TBLOG_RFID_ITEM
PRIMARY KEY (ID);

CREATE SEQUENCE GTBLOG_RFID_ITEM;

SET TERM ^ ;

create trigger ttblog_rfid_item_b01i for tblog_rfid_item
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtblog_rfid_item,1);
end
^

SET TERM ; ^

CREATE INDEX ITBLOG_RFID_ITEM_01
ON TBLOG_RFID_ITEM (LOG_RFID_ID);

CREATE INDEX ITBLOG_RFID_ITEM_02
ON TBLOG_RFID_ITEM (EPC);

