CREATE TABLE TIPORECEINTELOCAL( 
	CDINTEGRACAO 	VARCHAR2(3) 	NOT NULL,
	CDTPRECEINTE 	VARCHAR2(50) 	NOT NULL,  
	CDTIPORECE 		VARCHAR2(3) 	NOT NULL,
	CDFILIAL 		VARCHAR2(4) 	NOT NULL, 
    NRORG 			NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO 		VARCHAR2(1) 	DEFAULT 'S' NOT NULL,
		CONSTRAINT CKC_IDATIVO_TPRECEINTELOCAL CHECK (IDATIVO IN ('S','N')),
	DTINCLUSAO 		DATE 			NULL,
	DTULTATU 		DATE 			NULL, 
	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 PK_TIPORECEINTELOCAL PRIMARY KEY (CDINTEGRACAO, CDTPRECEINTE, CDTIPORECE, CDFILIAL)
)
/ 

CREATE INDEX VND00769_FK ON TIPORECEINTELOCAL (CDINTEGRACAO ASC)  
/

ALTER TABLE TIPORECEINTELOCAL
	ADD CONSTRAINT FKVND00769TIPORECEINTELCL FOREIGN KEY (CDINTEGRACAO)
		REFERENCES INTEGRACAO (CDINTEGRACAO)
/

CREATE INDEX VND00770_FK ON TIPORECEINTELOCAL (CDTIPORECE ASC)
/

ALTER TABLE TIPORECEINTELOCAL
	ADD CONSTRAINT FKVND00770TIPORECEINTELCL FOREIGN KEY (CDTIPORECE)
		REFERENCES TIPORECE (CDTIPORECE)
/

CREATE INDEX VND00771_FK ON TIPORECEINTELOCAL (CDFILIAL ASC)
/

ALTER TABLE TIPORECEINTELOCAL
	ADD CONSTRAINT FKVND00771TIPORECEINTELCL FOREIGN KEY (CDFILIAL)
		REFERENCES FILIAL (CDFILIAL)