CREATE TABLE PERIODOORCAGOP (
  NRPERIODOORCAGOP NUMBER(10) NOT NULL, 
  IDPERIODOORCA VARCHAR2(30) NOT NULL, 
  NRPERIODO NUMBER(10) NOT NULL, 
  DTINIPERIORCA DATE NOT NULL, 
  DTFIMPERIORCA 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_PERIODOORCAGOP PRIMARY KEY(NRPERIODOORCAGOP)
)
/
ALTER TABLE PERIODOORCAGOP ADD CONSTRAINT CKC_IDPERIODOORCA_PERIODOORCA CHECK (IDPERIODOORCA IN ('MENSAL', 'BIMESTRAL', 'TRIMESTRAL', 'QUADRIMESTRAL', 'SEMESTRAL', 'ANUAL'))
/
ALTER TABLE PERIODOORCAGOP ADD CONSTRAINT CKC_IDATIVO_PERIODOORCAGOP CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE CONCPREORCAGOP ADD DSOBSERVACAO VARCHAR2(4000) NULL
/
ALTER TABLE CONCPREORCAGOP ADD CDFILIAL VARCHAR2(04) NULL
/
ALTER TABLE CONCPREORCAGOP ADD CONSTRAINT FKGOP00718FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
CREATE INDEX FKGOP00718FILIAL ON CONCPREORCAGOP (CDFILIAL)