CREATE TABLE INVESTIMENTOROP (
  NRFILIALROP NUMBER(10) NOT NULL, 
  NRINVESTIMENTOROP NUMBER(10) NOT NULL, 
  IDTPLANCROP VARCHAR2(30) NOT NULL, 
  DTINVESTIMENTO DATE DEFAULT NULL NULL, 
  DTLANCAMENTO DATE DEFAULT NULL NULL, 
  CDFILCENTPME VARCHAR2(4) DEFAULT NULL NULL, 
  CDINVEST VARCHAR2(10) DEFAULT NULL NULL, 
  QTINVEST DOUBLE PRECISION DEFAULT NULL NULL, 
  VRINVEST DOUBLE PRECISION DEFAULT NULL NULL, 
  CDFILIALNF VARCHAR2(4) DEFAULT NULL NULL, 
  NRLANCTONF VARCHAR2(10) DEFAULT NULL NULL, 
  NRSEQVENPAG VARCHAR2(2) DEFAULT NULL NULL, 
  NRPARCELAPAG VARCHAR2(2) DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_INVESTIMENTOROP PRIMARY KEY(NRINVESTIMENTOROP)
)
/
ALTER TABLE INVESTIMENTOROP ADD CONSTRAINT CKC_IDTPLANCROP_INVESTIMENTO CHECK (IDTPLANCROP IN ('INVESTIMENTO'))
/
ALTER TABLE INVESTIMENTOROP ADD CONSTRAINT CKC_IDATIVO_INVESTIMENTOROP CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE INVESTIMENTOROP ADD CONSTRAINT FKGOP00715FILIALROP FOREIGN KEY (NRFILIALROP) REFERENCES FILIALROP (NRFILIALROP) ON DELETE CASCADE
/
CREATE INDEX FKGOP00715FILIALROP ON INVESTIMENTOROP (NRFILIALROP)