ALTER TABLE PARAMFISCAL ADD IDUTCREDDIFER VARCHAR2(01) DEFAULT 'N' NOT NULL 
   CONSTRAINT CKC_IDUTCREDDIFER_PARAMFISCAL CHECK (IDUTCREDDIFER IN ('N','S'))
/
ALTER TABLE DETAPURACONTR ADD VRCREDDIFERIDO FLOAT DEFAULT 0 NULL
/
ALTER TABLE DETAPURACONTR ADD VRCONTRIBDIF FLOAT DEFAULT 0 NULL
/
ALTER TABLE DETAPURACONTR ADD VRCONTRIBDIFANT FLOAT DEFAULT 0 NULL
/
ALTER TABLE IMPBAIXAREC ADD NRSEQMAPADIF VARCHAR2(10) NULL
/
CREATE INDEX FIS00734_FK ON IMPBAIXAREC (NRSEQMAPADIF  ASC)
/
ALTER TABLE IMPBAIXAREC 
  	ADD CONSTRAINT FKFIS00734MAPAAPUR FOREIGN KEY (NRSEQMAPADIF )
     		REFERENCES MAPAAPURAC (NRSEQUMAPAPU)
/
CREATE TABLE CONTRIBDIFERIDA 
(
   NRSEQCONTRDIF    	VARCHAR2(10)        NOT NULL,
   NRSEQUMAPAPU     	VARCHAR2(10)        NOT NULL,   
   CDFILIAL         		VARCHAR2(04)        NOT NULL,
   NRLANCTONF       	VARCHAR2(10)        NOT NULL,
   CDCLIENTE        		VARCHAR2(21)        NOT NULL,
   CDIMPOSTO        		VARCHAR2(02)        NOT NULL,
   CDSITUTRIB       		VARCHAR2(02)        NULL,
   CDCONTRIBAPUR    	VARCHAR2(02)        NULL,
   VRALIQUOTA       		FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTABIL       		FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTABILREC    	FLOAT         	DEFAULT 0   NOT NULL,
   VRBASECALC       		FLOAT        	DEFAULT 0   NOT NULL,
   VRBASECALCREC    	FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTNAOREC     	FLOAT         	DEFAULT 0   NOT NULL,
   VRBASENAOREC     	FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTRIBDIF     	FLOAT         	DEFAULT 0   NOT NULL,
   VRCREDDIFERIDO   	FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTRIBDIFAT   	FLOAT         	DEFAULT 0   NOT NULL,
   VRCREDDIFAT      		FLOAT         	DEFAULT 0   NOT NULL,
   VRCONTRIBDIFANT  	FLOAT        	DEFAULT 0   NOT NULL,
   NRSEQMAPADIF     	VARCHAR2(10)        NOT NULL,
   DTRECEBIMENTO    	DATE                      	NULL,
   NRORG                       	NUMBER 		DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_CONTRIBDIFERIDA  CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO             	DATE                   	NULL,
   DTULTATU                  	DATE                  	NULL,
   NRORGINCLUSAO      	NUMBER             	DEFAULT 1 NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          	NUMBER            	DEFAULT 1 NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1',
   CONSTRAINT PK_CONTRIBDIFERIDA PRIMARY KEY (NRSEQCONTRDIF)
)
/
CREATE INDEX FIS00735_FK ON CONTRIBDIFERIDA (NRSEQUMAPAPU ASC)
/
ALTER TABLE CONTRIBDIFERIDA
   ADD CONSTRAINT FKFIS00735MAPAAPURAC  FOREIGN KEY (NRSEQUMAPAPU)
      REFERENCES MAPAAPURAC (NRSEQUMAPAPU)
/
CREATE INDEX FIS00736_FK ON CONTRIBDIFERIDA (CDFILIAL ASC, NRLANCTONF ASC)
/
ALTER TABLE CONTRIBDIFERIDA
   ADD CONSTRAINT FKFIS00736NOTAFISCAL  FOREIGN KEY (CDFILIAL, NRLANCTONF)
      REFERENCES NOTAFISCAL (CDFILIAL, NRLANCTONF)
/
ALTER TABLE CONTRIBDIFERIDA
   ADD CONSTRAINT FKFIS00737CLIENTE  FOREIGN KEY (CDCLIENTE)
      REFERENCES CLIENTE (CDCLIENTE)
/
CREATE INDEX FIS00738_FK ON CONTRIBDIFERIDA (CDIMPOSTO ASC)
/
ALTER TABLE CONTRIBDIFERIDA
   ADD CONSTRAINT FKFIS00738IMPOSTO  FOREIGN KEY (CDIMPOSTO)
      REFERENCES IMPOSTO (CDIMPOSTO)
/
CREATE INDEX FIS00739_FK ON CONTRIBDIFERIDA (NRSEQMAPADIF ASC)
/
ALTER TABLE CONTRIBDIFERIDA
   ADD CONSTRAINT FKFIS00739MAPAAPURAC FOREIGN KEY (NRSEQMAPADIF)
      REFERENCES MAPAAPURAC (NRSEQUMAPAPU) ON DELETE CASCADE
/
CREATE TABLE CONTROLCREDDIF 
(
   NRSEQCREDDIF     	VARCHAR2(10)        NOT NULL,
   NRSEQCONTRDIF    	VARCHAR2(10)        NOT NULL,
   VRCREDDIFERIDO   	FLOAT          	DEFAULT 0     NULL,
   VRCONTRIBDIF    		FLOAT          	DEFAULT 0     NULL,
   VRCONTRIBDIFANT  	FLOAT          	DEFAULT 0     NOT NULL,
   VRCONTRIBDIFAT   	FLOAT         	DEFAULT 0   NOT NULL,
   VRCREDDIFAT      		FLOAT         	DEFAULT 0   NOT NULL,
   CDNATUCREDDIF    	VARCHAR2(02)   	DEFAULT '01'  NULL,
   CDTPCREDITO      	VARCHAR2(03)       	NULL,
   NRSEQMAPADIF     	VARCHAR2(10)        NOT NULL,
   NRORG                       	NUMBER 		DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_CONTROLCREDDIF CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO             	DATE                   	NULL,
   DTULTATU                  	DATE                  	NULL,
   NRORGINCLUSAO      	NUMBER             	DEFAULT 1 NULL,
   CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' NULL,
   NRORGULTATU          	NUMBER            	DEFAULT 1 NULL,
   CDOPERULTATU        	VARCHAR2(12)  	DEFAULT '1',
	CONSTRAINT PK_CONTROLCREDDIF PRIMARY KEY (NRSEQCREDDIF)
)
/
CREATE INDEX FIS00740_FK ON CONTROLCREDDIF (NRSEQCONTRDIF ASC)
/
ALTER TABLE CONTROLCREDDIF
   ADD CONSTRAINT FKFIS00740CONTRIBDIFERIDA  FOREIGN KEY (NRSEQCONTRDIF)
      REFERENCES CONTRIBDIFERIDA (NRSEQCONTRDIF) ON DELETE CASCADE
/
CREATE INDEX FIS00741_FK ON CONTROLCREDDIF (NRSEQMAPADIF ASC)
/
ALTER TABLE CONTROLCREDDIF
   ADD CONSTRAINT FKFIS00741MAPAAPURAC  FOREIGN KEY (NRSEQMAPADIF)
      REFERENCES MAPAAPURAC (NRSEQUMAPAPU) ON DELETE CASCADE