CREATE TABLE TBTALAO_VINCULO (
    ID INTEGER NOT NULL,
    REMESSA_ID INTEGER,
    TALAO_ID INTEGER,
    VINCULO_ID INTEGER
);

ALTER TABLE TBTALAO_VINCULO
ADD CONSTRAINT PK_TBTALAO_VINCULO
PRIMARY KEY (ID);

CREATE SEQUENCE GTBTALAO_VINCULO;

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

CREATE INDEX ITBTALAO_VINCULO_03
ON TBTALAO_VINCULO (VINCULO_ID);

CREATE INDEX ITBTALAO_VINCULO_02
ON TBTALAO_VINCULO (TALAO_ID);

CREATE INDEX ITBTALAO_VINCULO_01
ON TBTALAO_VINCULO (REMESSA_ID);

CREATE SEQUENCE GTBTALAO_VINCULO_ID START WITH 1;