CREATE TABLE FILIALROP (
  NRFILIALROP NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDOPERADOR VARCHAR2(12) DEFAULT NULL NULL, 
  DTINICROP DATE DEFAULT NULL NULL, 
  DTFINALROP DATE DEFAULT NULL NULL, 
  DTGERAROP DATE NOT NULL, 
  DTFILIALROP DATE 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_FILIALROP PRIMARY KEY(NRFILIALROP)
)
/
ALTER TABLE FILIALROP ADD CONSTRAINT CKC_IDATIVO_FILIALROP CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE FILIALROP ADD CONSTRAINT FKGOP00704FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
ALTER TABLE FILIALROP ADD CONSTRAINT FKGOP00705OPERADOR FOREIGN KEY (CDOPERADOR) REFERENCES OPERADOR (CDOPERADOR)
/
CREATE INDEX FKGOP00704FILIAL ON FILIALROP (CDFILIAL ASC)
/
CREATE INDEX FKGOP00705OPERADOR ON FILIALROP (CDOPERADOR)