CREATE TABLE ORCAMENTOGOP (
  NRORCAMENTOGOP NUMBER(10) NOT NULL, 
  NRANOORCAGOP NUMBER(10) NOT NULL, 
  IDPERIODOORCA VARCHAR2(30) NOT NULL, 
  NRPERIODOORCA NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) 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_ORCAMENTOGOP PRIMARY KEY(NRORCAMENTOGOP)
)
/
ALTER TABLE ORCAMENTOGOP ADD CONSTRAINT CKC_IDPERIODOORCA_ORCAMENTOGOP CHECK (IDPERIODOORCA IN ('MENSAL', 'BIMESTRAL', 'TRIMESTRAL', 'QUADRIMESTRAL', 'SEMESTRAL', 'ANUAL'))
/
ALTER TABLE ORCAMENTOGOP ADD CONSTRAINT CKC_IDATIVO_ORCAMENTOGOP CHECK (IDATIVO IN ('S','N'))
/
ALTER TABLE ORCAMENTOGOP ADD CONSTRAINT FKGOP00683FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
CREATE INDEX FKGOP00683FILIAL ON ORCAMENTOGOP (CDFILIAL)