CREATE TABLE FCT_PARAMFATITESCSERV (
	NRPARAMFATITESCSERV 		NUMBER  								NOT NULL,
	NRITESCOPOPROPOSTA  		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_PARFATITCSRV   		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_PARAMFATITESCSERV ADD CONSTRAINT PK_FCT_PARAMFATITESCSERV PRIMARY KEY (NRPARAMFATITESCSERV)
/
CREATE INDEX SM00210_FK ON FCT_PARAMFATITESCSERV (NRITESCOPOPROPOSTA ASC)
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT FKSM00210ITESC_ITSCOPPROPOS 
		FOREIGN KEY (NRITESCOPOPROPOSTA) REFERENCES FCT_ITESCOPOPROPOSTA (NRITESCOPOPROPOSTA)
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT CKC_IDATIVO_PARAMFATITESCSERV CHECK(IDATIVO IN ('S', 'N'))
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT CKC_MESCALC_PARAMFATITESCSERV CHECK(IDMESCALCVENC IN ('1', '2', '3'))
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT CKC_IDTPCALC_PARAMFATITESCSERV CHECK(IDTPCALCVENC IN ('1', '2'))
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT CKC_IDMESINI_PARAMFATITESCSERV CHECK(IDMESCOMPETINI IN ('1', '2', '3'))
/
ALTER TABLE FCT_PARAMFATITESCSERV ADD CONSTRAINT CKC_IDMESFIN_PARAMFATITESCSERV CHECK(IDMESCOMPETFIN IN ('1', '2', '3'))