ALTER TABLE PARASUPRI ADD IDCONSDESTITEMCOL VARCHAR2(1) DEFAULT 'N' NOT NULL
  CONSTRAINT CKC_IDCONSDESTITEMCOL_PARASUP CHECK (IDCONSDESTITEMCOL IN ('S','N'))
/
CREATE TABLE ITMAPURPRECIMPO
( 
   NRITMAPURPRECIMPO 	NUMBER 		NOT NULL,
   CDCENTITMAP 		VARCHAR2(4) 	NOT NULL, 
   NRSEQITMAP 		VARCHAR2(10) 	NOT NULL, 
   CDREGITMAP 		VARCHAR2(3) 	NOT NULL,
   CDFORNITMAP 		VARCHAR2(21) 	NOT NULL, 
   NRCOLEITMAP 		VARCHAR2(10) 	NOT NULL, 
   DTENTRAPUT 		DATE 		NOT NULL, 
   CDFILIAP 		VARCHAR2(4) 	NOT NULL, 
   CDPRODITMAP 		VARCHAR2(10) 	NOT NULL, 
   CDMARCITMAP 		VARCHAR2(10) 	NOT NULL, 
   CDIMPOSTO 		VARCHAR2(2) 	NOT NULL, 
   VRIMPOSTO 		FLOAT(126), 
   NRREGRAFISCAL 		VARCHAR2(10), 
   VRREDUBASECALC 	FLOAT(126), 
   VRMAJOBASECALC 	FLOAT(126), 
   VRPERCALIQUOTA 	FLOAT(126), 
   VRBASECALC 		FLOAT(126),  
   VRADIMPOSTOIT 		FLOAT(126),  
   IDTRATAMENTO 		VARCHAR2(1),
   CDGRUPOFISC         	VARCHAR2(3),
   NRORG                       	NUMBER 		DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_ITMAPURPRECIMPO 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_ITMAPURPRECIMPO PRIMARY KEY (NRITMAPURPRECIMPO),
	CONSTRAINT UN_ITMAPURPRECIMPO UNIQUE (CDCENTITMAP, NRSEQITMAP, CDREGITMAP, CDFORNITMAP, NRCOLEITMAP, DTENTRAPUT, CDFILIAP, CDPRODITMAP, CDMARCITMAP, CDIMPOSTO)
)
/
CREATE INDEX CMP00592_FK ON ITMAPURPRECIMPO (CDCENTITMAP ASC, NRSEQITMAP ASC, CDREGITMAP ASC, CDFORNITMAP ASC, NRCOLEITMAP ASC, DTENTRAPUT ASC, CDFILIAP ASC, CDPRODITMAP ASC, CDMARCITMAP ASC)
/
ALTER TABLE ITMAPURPRECIMPO ADD
	CONSTRAINT FKCMP00592ITMAPURPREC FOREIGN KEY (CDCENTITMAP, NRSEQITMAP, CDREGITMAP, CDFORNITMAP, NRCOLEITMAP, DTENTRAPUT, CDFILIAP, CDPRODITMAP, CDMARCITMAP)
		REFERENCES ITMAPURPREC(CDCENTITMAP, NRSEQITMAP, CDREGITMAP, CDFORNITMAP, NRCOLEITMAP, DTENTRAPUT, CDFILIAP, CDPRODITMAP, CDMARCITMAP) ON DELETE CASCADE