CREATE TABLE VND_RELRETRANSMISSAO (
	ID 				  INTEGER NOT NULL,
	CDFILIAL 		  VARCHAR(10),
	CDCAIXA 		  VARCHAR(4),
	NRSEQVENDA 		  VARCHAR(100),
	DTVENDA 	 	  DATE NOT NULL,
	NRNOTAFISCALCE 	  VARCHAR(100),
	NRACESSONFCE 	  VARCHAR(100),
	IDSTATUSNFCE 	  VARCHAR(100),
	DTEMISSAO 	   	  DATE NOT NULL,
	OLDNRNOTAFISCALCE VARCHAR(100),
	OLDNRACESSONFCE   VARCHAR(100),
	OLDDTEMISSAO 	  DATE NOT NULL,
	OLDIDSTATUSNFCE   VARCHAR(100),
	MOTIVORET 		  VARCHAR(100),
	CDOPERADOR 		  VARCHAR(20),
    NRORG             NUMBER 	      		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     		DEFAULT 'S' 					NOT NULL
		CONSTRAINT CKC_IDATIVO_VND_RELRETRANSM CHECK (IDATIVO IN ('S','N')),
    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 PK_VND_RELRETRANSMISSAO PRIMARY KEY (ID),
		CONSTRAINT FKVND00826NRSEQVENDA FOREIGN KEY (NRSEQVENDA, CDCAIXA, CDFILIAL) 
			REFERENCES VENDA(NRSEQVENDA, CDCAIXA, CDFILIAL)
)
/

CREATE INDEX VND00826_FK ON VND_RELRETRANSMISSAO (NRSEQVENDA ASC, CDCAIXA ASC, CDFILIAL ASC)
/ 