CREATE TABLE IMP_PARAMPRATFILIAL (
		NRIMPPARAMPRATFILIAL 	NUMBER 			NOT NULL,
		NRINDICE 				NUMBER 			NOT NULL, 
		CDFILIAL 				VARCHAR2(4)		NOT NULL, 
		CDFILAUXPRAT 			VARCHAR2(4) 	NULL, 
		CDPRATO 				VARCHAR2(10) 	NULL,
		NMAGRUPGRPRAT 			VARCHAR2(40)	NULL, 
		NMGRUPOPRATO 			VARCHAR2(40)	NULL,
		IDCOMPLEXIDADE 			VARCHAR2(30) 	NULL,
		IDPREPREPARO 			VARCHAR2(3) 	NULL,
		IDCOR 					VARCHAR2(30) 	NULL,
		NMINGREDIENTEPRINC1     VARCHAR2(100) 	NULL,
		NMINGREDIENTEPRINC2     VARCHAR2(100) 	NULL,
		NMAPRERECE 				VARCHAR2(60) 	NULL,
		NMFORMAPREPARO 			VARCHAR2(30) 	NULL,
		NMATRATIVIDADEPRATO  	VARCHAR2(100) 	NULL, 
		NRORG             		NUMBER 	      	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
		IDATIVO           		VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
		DTINCLUSAO        		DATE            DEFAULT SYSDATE,
		DTULTATU          		DATE            DEFAULT SYSDATE,
		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',
			CONSTRAINT CKC_IDATIVO_IMP_PARAMPRAFILIAL CHECK (IDATIVO IN ('S','N'))
)
/
ALTER TABLE IMP_PARAMPRATFILIAL ADD CONSTRAINT FKGOP00741PARAMPRAT_FILIAL
	FOREIGN KEY(CDFILIAL) REFERENCES FILIAL(CDFILIAL) ON DELETE CASCADE
/
CREATE INDEX GOP00741_FK ON IMP_PARAMPRATFILIAL (CDFILIAL)
/
CREATE TABLE LOG_IMP_PARAMPRATFI (
		NRLOGIMPARAMPRATFI NUMBER 		   NOT NULL, 
		DSLOGIMPARAMPRATFI VARCHAR2(4000)  NOT NULL,
		NRORG              NUMBER 	       DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
		IDATIVO            VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
		DTINCLUSAO         DATE            DEFAULT SYSDATE,
		DTULTATU           DATE            DEFAULT SYSDATE,
		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',
			CONSTRAINT CKC_IDATIVO_LOG_IMP_PARAMPRAFI CHECK (IDATIVO IN ('S','N'))
)
/
CREATE INDEX LOG_IMP_PARAMPRATFI_01 ON LOG_IMP_PARAMPRATFI (NRLOGIMPARAMPRATFI)
/