CREATE TABLE FCT_PARAMFATCOMPETITEM (
	NRPARAMFATCOMPETITEM 		NUMBER	 								NOT NULL,
	NRITEMOCONTRATO      		NUMBER									NOT NULL,
	NRDIACOMPETINI       		NUMBER 									NOT NULL,     
	NRDIACOMPETFIN       		NUMBER 									NOT NULL,     
	IDMESCOMPETINI       		CHAR(1)									NOT NULL,     
	IDMESCOMPETFIN       		CHAR(1)									NOT NULL,     
	QTDIASAPURACAO       		NUMBER 									NOT NULL,     
	IDTPCALCVENC         		CHAR(1)									NOT NULL,     
	NRDIACALCVENC        		NUMBER 									NOT NULL,     
	IDMESCALCVENC        		CHAR(1),      
	QTDIASFATUVENC       		NUMBER,      
	NRORG                  		NUMBER          DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') 	NOT NULL,
    	IDATIVO                		VARCHAR2(1)     DEFAULT 'S' 						NOT NULL
    		CONSTRAINT CKC_IDATIVO_FCT_PARFATCOMPITM   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'
)
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT PK_FCT_PARAMFATCOMPETITEM PRIMARY KEY (NRPARAMFATCOMPETITEM)
/
CREATE INDEX SM00211_FK ON FCT_PARAMFATCOMPETITEM (NRITEMOCONTRATO ASC)
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT FKSM00211ITESC_ITEMCONTRATO 
		FOREIGN KEY (NRITEMOCONTRATO) REFERENCES FCT_ITEMCONTRATO (NRITEMOCONTRATO)
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT CKC_IDATIVO_FATCOMPETITEM CHECK(IDATIVO IN ('S', 'N'))
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT CKC_MESCALC_FATCOMPETITEM CHECK(IDMESCALCVENC IN ('1', '2', '3'))
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT CKC_IDTPCALC_FATCOMPETITEM CHECK(IDTPCALCVENC IN ('1', '2'))
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT CKC_IDMESINI_FATCOMPETITEM CHECK(IDMESCOMPETINI IN ('1', '2', '3'))
/
ALTER TABLE FCT_PARAMFATCOMPETITEM ADD CONSTRAINT CKC_IDMESFIN_FATCOMPETITEM CHECK(IDMESCOMPETFIN IN ('1', '2', '3'))