CREATE TABLE TBMDF_PERCURSO (
    ID INTEGER NOT NULL,
    MDF_ID INTEGER NOT NULL,
    UF VARCHAR(2),
    DATAHORA TIMESTAMP DEFAULT 'NOW');

ALTER TABLE TBMDF_PERCURSO
ADD CONSTRAINT PK_TBMDF_PERCURSO
PRIMARY KEY (ID);

CREATE SEQUENCE GTBMDF_PERCURSO;

CREATE TRIGGER TBMDF_PERCURSO_B01I FOR TBMDF_PERCURSO
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  IF (NEW.ID IS NULL) THEN
    NEW.ID = GEN_ID(GTBMDF_PERCURSO,1);
END;

CREATE INDEX TBMDF_PERCURSO_01
ON TBMDF_PERCURSO (MDF_ID);

CREATE INDEX TBMDF_PERCURSO_02
ON TBMDF_PERCURSO (UF);