CREATE TABLE PERCITDETALFILGOP (
  NRPERCITFILGOP NUMBER(10) NOT NULL, 
  NRPERCITDETALFILGOP NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDPRODUTO VARCHAR2(10) DEFAULT NULL NULL, 
  CDIMPOSTO VARCHAR2(2) DEFAULT NULL NULL, 
  CDTIPOOPER VARCHAR2(2) DEFAULT NULL NULL, 
  CDFILIALMO VARCHAR2(4) DEFAULT NULL NULL, 
  IDENTRSAIDOP VARCHAR2(1) DEFAULT NULL NULL, 
  CDINVEST VARCHAR2(10) DEFAULT NULL NULL, 
  CDORCAMENTOMO VARCHAR2(10) DEFAULT NULL NULL, 
  CDDESPPREV VARCHAR2(3) DEFAULT NULL NULL, 
  IDDESPPREV VARCHAR2(30) DEFAULT NULL NULL, 
  VRPERCENTUAL DOUBLE PRECISION DEFAULT NULL NULL, 
  VRPERCLIMDIAGOP DOUBLE PRECISION 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_PERCITDETALFILGOP PRIMARY KEY(NRPERCITDETALFILGOP)
)
/
ALTER TABLE PERCITDETALFILGOP ADD CONSTRAINT CKC_IDENTRSAIDOP_PERITDETALFIL CHECK (IDENTRSAIDOP IS NULL OR(IDENTRSAIDOP IN ('E', 'S')))
/
ALTER TABLE PERCITDETALFILGOP ADD CONSTRAINT CKC_IDDESPPREV_PERCITDETALFIL CHECK (IDDESPPREV IS NULL OR (IDDESPPREV IN ('DIVERSA', 'MATRIZ', 'LANCENTRADA')))
/
ALTER TABLE PERCITDETALFILGOP ADD CONSTRAINT CKC_IDATIVO_PERCITDETALFILGOP CHECK (IDATIVO IN ('S', 'N'))
/
CREATE INDEX FKGOP00668PERCITFILGOP ON PERCITDETALFILGOP (NRPERCITFILGOP)
/
CREATE INDEX FKGOP00669FILIAL ON PERCITDETALFILGOP (CDFILIAL)
/
CREATE INDEX FKGOP00670PRODUTO ON PERCITDETALFILGOP (CDPRODUTO)
/
CREATE INDEX FKGOP00671IMPOSTO ON PERCITDETALFILGOP (CDIMPOSTO)
/
CREATE INDEX FKGOP00672TIPOOPERAC ON PERCITDETALFILGOP (CDTIPOOPER, IDENTRSAIDOP)
/
CREATE INDEX FKGOP00673INVESTIMENTOS ON PERCITDETALFILGOP (CDINVEST)
/
CREATE INDEX FKGOP00674ORCAMENTOMO ON PERCITDETALFILGOP (CDORCAMENTOMO)
/
CREATE INDEX FKGOP00675DESPPREV ON PERCITDETALFILGOP (CDDESPPREV)