CREATE TABLE TBPDV_REPRESENTANTE (
    ID INTEGER NOT NULL,
    REPRESENTANTE_ID INTEGER,
    PDV_ID INTEGER);

ALTER TABLE TBPDV_REPRESENTANTE
ADD CONSTRAINT PK_TBPDV_REPRESENTANTE
PRIMARY KEY (ID);

CREATE SEQUENCE GTBPDV_REPRESENTANTE;



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


