CREATE TABLE TBNF_LOGS (
    ID INTEGER NOT NULL,
    PDV_CFE_ID INTEGER,
    "LOG" BLOB SUB_TYPE 1 SEGMENT SIZE 80,
    DATAHORA TIMESTAMP DEFAULT 'NOW');

ALTER TABLE TBNF_LOGS
ADD CONSTRAINT PK_TBNF_LOGS
PRIMARY KEY (ID);

CREATE SEQUENCE GTBNF_LOGS;

SET TERM ^ ;

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

SET TERM ; ^

CREATE INDEX ITBNF_LOGS_01
ON TBNF_LOGS (PDV_CFE_ID);

