CREATE TABLE DATAAPURACAOROP (
  NRDATAAPURACAOROP NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  DTINIAPURACROP DATE NOT NULL, 
  DTFINAPURACROP DATE 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_DATAAPURACAOROP PRIMARY KEY(NRDATAAPURACAOROP)
)
/
ALTER TABLE DATAAPURACAOROP ADD CONSTRAINT CKC_IDATIVO_DATAAPURACAOROP CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE DATAAPURACAOROP ADD CONSTRAINT FKGOP00703FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
CREATE INDEX FKGOP00703FILIAL ON DATAAPURACAOROP (CDFILIAL)