CREATE TABLE PERCDETPRODFILGOP (
  NRPERCITDETALFILGOP NUMBER(10) NOT NULL, 
  NRPERCDETPRODFILGOP NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDPRODUTO VARCHAR2(10) DEFAULT NULL NULL, 
  CDORCAMENTOMO VARCHAR2(10) DEFAULT NULL NULL, 
  CDDESPADMFAT VARCHAR2(2) DEFAULT NULL NULL, 
  CDTIPOOPER VARCHAR2(2) DEFAULT NULL NULL, 
  CDGRUPGERENTEOP VARCHAR2(10) DEFAULT NULL NULL, 
  CDFILIALMO VARCHAR2(4) DEFAULT NULL NULL, 
  IDENTRSAIDOP VARCHAR2(1) 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_PERCDETPRODFILGOP PRIMARY KEY(NRPERCDETPRODFILGOP)
)
/
ALTER TABLE PERCDETPRODFILGOP ADD CONSTRAINT CKC_IDENTRSAIDOP_PERDETPRODFIL CHECK (IDENTRSAIDOP IS NULL OR (IDENTRSAIDOP IN ('E', 'S')))
/
ALTER TABLE PERCDETPRODFILGOP ADD CONSTRAINT CKC_IDATIVO_PERCDETPRODFILGOP CHECK (IDATIVO IN ('S', 'N'))
/
CREATE INDEX FKGOP00676PERCITDETALFILGOP ON PERCDETPRODFILGOP (NRPERCITDETALFILGOP)
/
CREATE INDEX FKGOP00677FILIAL ON PERCDETPRODFILGOP (CDFILIAL)
/
CREATE INDEX FKGOP00678PRODUTO ON PERCDETPRODFILGOP (CDPRODUTO)
/
CREATE INDEX FKGOP00679DESPORCAMO ON PERCDETPRODFILGOP (CDORCAMENTOMO, CDDESPADMFAT)
/
CREATE INDEX FKGOP00680TIPOOPERAC ON PERCDETPRODFILGOP (CDTIPOOPER, IDENTRSAIDOP)