ALTER TABLE FPA_FORMCONTABIL ADD (
  IDFORMACONTAB VARCHAR2(1) DEFAULT 'C' NOT NULL
) 
/
ALTER TABLE FPA_FORMCONTABIL ADD CONSTRAINT CKC_IDFORMACONTAB CHECK (IDFORMACONTAB in ('C','D','T'))
/
ALTER TABLE FPA_EVENTOCTBL ADD (
  CDDESPADMFAT VARCHAR2(2) DEFAULT NULL NULL
)
/
ALTER TABLE FPA_EVENTOCTBL MODIFY (
  NRESTRUTURAM NUMBER(10) DEFAULT NULL NULL
)
/
ALTER TABLE FPA_EVENTOCTBL ADD CONSTRAINT FPA_RESUMODRO_DESPADFA FOREIGN KEY (CDDESPADMFAT) REFERENCES DESPADMFATUR (CDDESPADMFAT)
/
ALTER TABLE DESPADMFATUR MODIFY (
  CDPRODUTO VARCHAR2(10) DEFAULT NULL NULL, 
  CDGRUPOFATUR VARCHAR2(2) DEFAULT NULL NULL
)
/
CREATE TABLE FPA_RESUMODRO (
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  NRRESUMODRO NUMBER(10) NOT NULL, 
  DTOCORRENCIA DATE NOT NULL, 
  NRTIPOMOVIMENT NUMBER(10) DEFAULT NULL NULL, 
  NRESTRUTURAMSUP NUMBER(10) NOT NULL, 
  NRESTRUTURAM NUMBER(10) NOT NULL, 
  CDDESPADMFAT VARCHAR2(12) DEFAULT NULL NULL, 
  VRLANCAMENTO DOUBLE PRECISION DEFAULT NULL NULL, 
  NRQTDEVINC NUMBER(10) DEFAULT NULL NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_FPA_RESUMODRO PRIMARY KEY(NRRESUMODRO)
)
/
ALTER TABLE FPA_RESUMODRO ADD CONSTRAINT FPA_RESUMODRO_TIPOMOVI FOREIGN KEY (NRTIPOMOVIMENT) REFERENCES FPA_TIPOMOVIMENT (NRTIPOMOVIMENT)
/
ALTER TABLE FPA_RESUMODRO ADD CONSTRAINT FPA_RESUMODRO_ESTRUTURAM_FK1 FOREIGN KEY (NRESTRUTURAM) REFERENCES ESTRUTURAM (NRESTRUTURAM)
/
ALTER TABLE FPA_RESUMODRO ADD CONSTRAINT FPA_RESUMODRO_ESTRUTURAM_FK2 FOREIGN KEY (NRESTRUTURAMSUP) REFERENCES ESTRUTURAM (NRESTRUTURAM)
/
ALTER TABLE FPA_RESUMODRO ADD CONSTRAINT FPA_RESUMODRO_DESPADMFAT_FK1 FOREIGN KEY (CDDESPADMFAT) REFERENCES DESPADMFATUR (CDDESPADMFAT)