CREATE TABLE TBPDV_CFE_ITEM_SALDO (
    ID INTEGER NOT NULL,
    PDV_CFE_ITEM_ID INTEGER,
    PDV_CFE_ID INTEGER,
    QUANTIDADE NUMERIC(15,4),
    DATAHORA TIMESTAMP DEFAULT 'NOW');


ALTER TABLE TBPDV_CFE_ITEM_SALDO
ADD CONSTRAINT PK_TBPDV_CFE_ITEM_SALDO
PRIMARY KEY (ID);

CREATE SEQUENCE GTBPDV_CFE_ITEM_SALDO;

create trigger tbpdv_cfe_item_saldo_b01i for tbpdv_cfe_item_saldo
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtbpdv_cfe_item_saldo,1);
end;