CREATE TABLE CONCPREORCAGOP (
  NRCALENPREORCAGOP NUMBER(10) NOT NULL, 
  NRCONCPREORCAGOP NUMBER(10) NOT NULL, 
  DTINICIALPREP DATE DEFAULT NULL NULL, 
  DTFINALPREP DATE DEFAULT NULL NULL, 
  IDSTATUS VARCHAR2(30) DEFAULT 'PENDENTE' NOT 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_CONCPREORCAGOP PRIMARY KEY(NRCONCPREORCAGOP)
)
/
ALTER TABLE CONCPREORCAGOP ADD CONSTRAINT CKC_IDSTATUS_CONCPREORCAGOP CHECK (IDSTATUS IN ('PENDENTE', 'CONCLUIDO'))
/
ALTER TABLE CONCPREORCAGOP ADD CONSTRAINT CKC_IDATIVO_CONCPREORCAGOP CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE CONCPREORCAGOP ADD CONSTRAINT FKGOP00682CALENPREORCAGOP FOREIGN KEY (NRCALENPREORCAGOP) REFERENCES CALENPREORCAGOP (NRCALENPREORCAGOP)
/
CREATE INDEX FKGOP00682CALENPREORCAGOP ON CONCPREORCAGOP (NRCALENPREORCAGOP)