CREATE TABLE EXTRATOCONSCANC (
   CDCLIENTE      		VARCHAR2(21)	NOT NULL,
   CDCONSUMIDOR   	VARCHAR2(21) 	NOT NULL,
   CDFAMILISALD   		VARCHAR2(3)  	NOT NULL,
   DTMOVEXTCONS   	DATE         	NOT NULL,
   NRSEQMOVEXT    	VARCHAR2(3)  	NOT NULL,
   NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_EXTRATOCONSCANC  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_EXTRATOCONSCANC PRIMARY KEY (CDCLIENTE, CDCONSUMIDOR, CDFAMILISALD, DTMOVEXTCONS, NRSEQMOVEXT)
)
/

CREATE INDEX VND00762_FK ON EXTRATOCONSCANC (CDCLIENTE ASC)
/

ALTER TABLE EXTRATOCONSCANC ADD
	CONSTRAINT FKVND00762PERFILACESSO  FOREIGN KEY (CDCLIENTE) 
		REFERENCES CLIENTE (CDCLIENTE) 
/

CREATE INDEX VND00763_FK ON EXTRATOCONSCANC (CDCLIENTE ASC, CDCONSUMIDOR ASC)
/

ALTER TABLE EXTRATOCONSCANC ADD
	CONSTRAINT FKVND00763PERFILACESSO  FOREIGN KEY (CDCLIENTE, CDCONSUMIDOR) 
		REFERENCES CONSUMIDOR (CDCLIENTE, CDCONSUMIDOR)