CREATE TABLE INTEGRACAOFILI
(
 CDINTEGRACAO          	VARCHAR2(3),  
 CDFILIAL              		VARCHAR2(4), 
 IDTOKEN               		VARCHAR2(50),
 NRORG           		NUMBER    	DEFAULT   SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO   		VARCHAR2(1) 	DEFAULT 'S'   NOT NULL
	CONSTRAINT CKC_IDATIVO_INTEGRACAOFILI 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' NULL,
	CONSTRAINT PK_INTEGRACAOFILI PRIMARY KEY (CDFILIAL, CDINTEGRACAO)
)
/
CREATE INDEX VND00749_FK ON INTEGRACAOFILI (CDINTEGRACAO)
/
ALTER TABLE INTEGRACAOFILI
	ADD CONSTRAINT FKVND00749INTEGRACAO FOREIGN KEY (CDINTEGRACAO) 
		REFERENCES INTEGRACAO (CDINTEGRACAO)
/
CREATE INDEX VND00750_FK ON INTEGRACAOFILI (CDFILIAL)
/
ALTER TABLE INTEGRACAOFILI
	ADD CONSTRAINT FKVND00750FILIAL FOREIGN KEY (CDFILIAL) 
		REFERENCES FILIAL (CDFILIAL)
/
CREATE TABLE PLATAFORMAVEND
(
    CDPLATAFORMAVEND 	VARCHAR2(3),
    NMPLATAFORMAVEND 	VARCHAR2(50),
    IDPLATAFORMAVEND 	VARCHAR2(3),
    NRORG           		NUMBER    	DEFAULT   SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO   		VARCHAR2(1) 	DEFAULT 'S'   NOT NULL
	CONSTRAINT CKC_IDATIVO_PLATAFORMAVEND 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' NULL,
	CONSTRAINT PK_PLATAFORMAVEND PRIMARY KEY (CDPLATAFORMAVEND)
)