ALTER TABLE FCT_PARAMETROGERAL ADD IDBLOQREAJSEMALIQ VARCHAR2(10) DEFAULT 'NAO' 
/ 

ALTER TABLE FCT_PARAMETROGERAL
  ADD CONSTRAINT CKC_IDBLOQREAJSEMALIQ CHECK (IDBLOQREAJSEMALIQ IN ('TODOS', 'INDIVIDUAL', 'NAO'))
/

ALTER TABLE FCT_PARAMETROGERAL ADD IDBLOQAPURFATSEMREAJ CHAR(1) DEFAULT 'N'
/

ALTER TABLE FCT_PARAMETROGERAL
  ADD CONSTRAINT CKC_IDBLOQAPURFATSEMREAJ CHECK (IDBLOQAPURFATSEMREAJ IN ('S', 'N'))
/

CREATE TABLE FCT_INDICESPADROES(
   NRINDICESPADROES 	NUMBER       	NOT NULL,
   CDTPINDICE       	VARCHAR2(1)  	NOT NULL,
   IDPERVALOR       	VARCHAR2(1)  	NOT NULL,
   CDINDICE         	VARCHAR2(4)  	NOT NULL,
   NRPERCENTINDICE  	NUMBER       	NOT NULL,
   NRORG                NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_INDPAD CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO           DATE            NULL,
   DTULTATU             DATE            NULL,
   NRORGINCLUSAO      	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')  NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          NUMBER 			DEFAULT  SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1'
)
/

ALTER TABLE FCT_INDICESPADROES
  ADD CONSTRAINT PK_FCT_INDICESPADROES PRIMARY KEY (NRINDICESPADROES)
/

CREATE INDEX SM00285_FK	ON FCT_INDICESPADROES (CDTPINDICE ASC, IDPERVALOR ASC, CDINDICE ASC)
/ 

ALTER TABLE FCT_INDICESPADROES
  ADD CONSTRAINT FKSM00285INDICE FOREIGN KEY (CDTPINDICE, IDPERVALOR, CDINDICE)
      REFERENCES INDICE (CDTPINDICE, IDPERVALOR, CDINDICE)
/

CREATE TABLE FCT_INDICESPADRESCOPO (
   NRINDICESPADRESCOPO	NUMBER       	NOT NULL,
   NRTIPOORCAMENTO     	NUMBER       	NOT NULL,
   CDTPINDICE          	VARCHAR2(1) 	NOT NULL,
   IDPERVALOR          	VARCHAR2(1)  	NOT NULL,
   CDINDICE            	VARCHAR2(4)  	NOT NULL,
   NRPERCENTINDICE     	NUMBER       	NOT NULL,
   NRORG                NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_INDPADSC CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO           DATE            NULL,
   DTULTATU             DATE            NULL,
   NRORGINCLUSAO      	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')  NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          NUMBER 			DEFAULT  SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1'
)
/

ALTER TABLE FCT_INDICESPADRESCOPO
  ADD CONSTRAINT PK_FCT_INDICESPADRESCOPO PRIMARY KEY (NRINDICESPADRESCOPO)
/

CREATE INDEX SM00286_FK	ON FCT_INDICESPADRESCOPO (NRTIPOORCAMENTO ASC)
/ 

ALTER TABLE FCT_INDICESPADRESCOPO
  ADD CONSTRAINT FKSM00286TIPOORCAMENTO FOREIGN KEY (NRTIPOORCAMENTO)
      REFERENCES FCT_TIPOORCAMENTO (NRTIPOORCAMENTO)
/

CREATE INDEX SM00287_FK	ON FCT_INDICESPADRESCOPO (CDTPINDICE ASC, IDPERVALOR ASC, CDINDICE ASC)
/ 

ALTER TABLE FCT_INDICESPADRESCOPO
  ADD CONSTRAINT FKSM00287INDICE FOREIGN KEY (CDTPINDICE, IDPERVALOR, CDINDICE)
      REFERENCES INDICE (CDTPINDICE, IDPERVALOR, CDINDICE)
/

CREATE TABLE FCT_INDICESPADRPARC (
   NRINDICESPADRPARC 	NUMBER       	NOT NULL,
   NRPARCNEGOCIO     	NUMBER       	NOT NULL,
   CDTPINDICE        	VARCHAR2(1)  	NOT NULL,
   IDPERVALOR        	VARCHAR2(1)  	NOT NULL,
   CDINDICE          	VARCHAR2(4)  	NOT NULL,
   NRPERCENTINDICE   	NUMBER       	NOT NULL,
   NRORG                NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_INDPADPARC CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO           DATE            NULL,
   DTULTATU             DATE            NULL,
   NRORGINCLUSAO      	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')  NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          NUMBER 			DEFAULT  SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1'
)
/

ALTER TABLE FCT_INDICESPADRPARC
  ADD CONSTRAINT PK_FCT_INDICESPADRPARC PRIMARY KEY (NRINDICESPADRPARC)
/

CREATE INDEX SM00288_FK	ON FCT_INDICESPADRPARC (NRPARCNEGOCIO ASC)
/ 

ALTER TABLE FCT_INDICESPADRPARC
  ADD CONSTRAINT FKSM00288PARCNEGOCIO FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

CREATE INDEX SM00289_FK	ON FCT_INDICESPADRPARC (CDTPINDICE ASC, IDPERVALOR ASC, CDINDICE ASC)
/ 

ALTER TABLE FCT_INDICESPADRPARC
  ADD CONSTRAINT FKSM00289INDICE FOREIGN KEY (CDTPINDICE, IDPERVALOR, CDINDICE)
      REFERENCES INDICE (CDTPINDICE, IDPERVALOR, CDINDICE)
/

CREATE TABLE FCT_INDICESPADRCONTR (
   NRINDICESPADRCONTR 	NUMBER       	NOT NULL,
   NRSEQCONTRATO      	NUMBER       	NOT NULL,
   CDTPINDICE         	VARCHAR2(1)  	NOT NULL,
   IDPERVALOR         	VARCHAR2(1)  	NOT NULL,
   CDINDICE           	VARCHAR2(4)  	NOT NULL,
   NRPERCENTINDICE    	NUMBER       	NOT NULL,
   NRORG                NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_INDPADCON CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO           DATE            NULL,
   DTULTATU             DATE            NULL,
   NRORGINCLUSAO      	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')  NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          NUMBER 			DEFAULT  SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1'
)
/

ALTER TABLE FCT_INDICESPADRCONTR
  ADD CONSTRAINT PK_FCT_INDICESPADRCONTR PRIMARY KEY (NRINDICESPADRCONTR)
/

CREATE INDEX SM00290_FK	ON FCT_INDICESPADRCONTR (NRSEQCONTRATO ASC)
/ 

ALTER TABLE FCT_INDICESPADRCONTR
  ADD CONSTRAINT FKSM00290FCT_CONTRATO FOREIGN KEY (NRSEQCONTRATO)
      REFERENCES FCT_CONTRATO (NRSEQCONTRATO)
/

CREATE INDEX SM00291_FK	ON FCT_INDICESPADRCONTR (CDTPINDICE ASC, IDPERVALOR ASC, CDINDICE ASC)
/ 

ALTER TABLE FCT_INDICESPADRCONTR
  ADD CONSTRAINT FKSM00291INDICE FOREIGN KEY (CDTPINDICE, IDPERVALOR, CDINDICE)
      REFERENCES INDICE (CDTPINDICE, IDPERVALOR, CDINDICE)
/

CREATE INDEX FIS00773_FK ON EMPRESA (CDLOGRADOURO ASC)
/ 

ALTER TABLE EMPRESA
  ADD CONSTRAINT FKFKFIS00773LOGRADOURO FOREIGN KEY (CDLOGRADOURO )
      REFERENCES LOGRADOURO (CDLOGRADOURO )