CREATE TABLE TBPDV_CFE_PARCELAS (
    ID INTEGER NOT NULL,
    PDV_CFE_ID INTEGER,
    PARCELA INTEGER,
    DATA_VENCIMENTO DATE,
    VALOR NUMERIC(15,2),
    DATAHORA TIMESTAMP DEFAULT 'NOW');

ALTER TABLE TBPDV_CFE_PARCELAS
ADD CONSTRAINT PK_TBPDV_CFE_PARCELAS
PRIMARY KEY (ID);

CREATE SEQUENCE GTBPDV_CFE_PARCELAS;

SET TERM ^ ;

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

SET TERM ; ^


