-- ================================================================================
-- TABLE: VERCARDAMES
-- ================================================================================
CREATE TABLE VERCARDAMES(
 NRVERCARDAMES 		NUMBER 		NOT NULL, 
 CDFILIAL 		VARCHAR2(4) 	NOT NULL,
 CDSERVFILI 		VARCHAR2(5) 	NULL,
 DTMESCARDAPIO 		DATE 		NOT NULL,
 CDTIPOCUSTO 		VARCHAR2(2) 	NOT NULL, 
 DTREFECUSTMES 		DATE 		NOT NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
	CONSTRAINT CKC_IDATIVO_VERCARDAMES 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_VERCARDAMES PRIMARY KEY (NRVERCARDAMES)
)
/

ALTER TABLE VERCARDAMES ADD
	CONSTRAINT FKPLA01189CARDAMES FOREIGN KEY (CDFILIAL, CDSERVFILI, DTMESCARDAPIO)
		REFERENCES CARDAMES (CDFILIAL, CDSERVFILI, DTMESCARDAPIO)	ON DELETE CASCADE
/

CREATE INDEX PLA01189_FK ON VERCARDAMES (CDFILIAL ASC, CDSERVFILI ASC, DTMESCARDAPIO ASC)
/

ALTER TABLE VERCARDAMES ADD
	CONSTRAINT FKPLA01190TIPOCUSTO FOREIGN KEY (CDTIPOCUSTO)
		REFERENCES TIPOCUSTO (CDTIPOCUSTO)
/

CREATE INDEX PLA01190_FK ON VERCARDAMES (CDTIPOCUSTO)
/

-- ================================================================================
-- TABLE: VERCARDADIA
-- ================================================================================
CREATE TABLE VERCARDADIA(
 NRVERCARDADIA 		NUMBER 		NOT NULL,
 NRVERCARDAMES 		NUMBER 		NOT NULL,
 CDFILIAL 		VARCHAR2(4)	NOT NULL,
 NRCARDAPIO 		VARCHAR2(10) 	NOT NULL,
 DTCARDAPIO		DATE NOT	NULL,
 CDDIETPAD 		VARCHAR2(4) 	NULL,
 QTCOMESTICAR 		FLOAT 		NULL,
 QTESTITURNO1 		FLOAT 		NULL,
 QTESTITURNO2 		FLOAT 		NULL,
 QTESTITURNO3 		FLOAT 		NULL,
 QTESTITURNO4 		FLOAT 		NULL,
 QTCLIESTICAR 		FLOAT 		NULL,
 QTFUNESTICAR 		FLOAT 		NULL,
 QTDOAESTICAR 		FLOAT 		NULL,
 QTCOMEFETCAR		FLOAT 		NULL,
 QTCLIEFETCAR 		FLOAT 		NULL,
 QTFUNEFETCAR 		FLOAT 		NULL,
 QTDOAEFETCAR 		FLOAT 		NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCARDADIA 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_VERCARDADIA PRIMARY KEY (NRVERCARDADIA),
	CONSTRAINT UN_VERCARDADIA UNIQUE (NRVERCARDAMES, DTCARDAPIO, CDDIETPAD)
)
/

ALTER TABLE VERCARDADIA ADD
	CONSTRAINT FKPLA01191VERCARDAMES FOREIGN KEY (NRVERCARDAMES)
		REFERENCES VERCARDAMES (NRVERCARDAMES) ON DELETE CASCADE
/

CREATE INDEX PLA01191_FK ON VERCARDADIA (NRVERCARDAMES ASC)
/

ALTER TABLE VERCARDADIA ADD
	CONSTRAINT FKPLA01192DIETPADR FOREIGN KEY (CDDIETPAD)
		REFERENCES DIETPADR (CDDIETPAD)
/

CREATE INDEX PLA01192_FK ON VERCARDADIA (CDDIETPAD ASC)
/

CREATE INDEX PLA01193_FK ON VERCARDADIA (NRVERCARDAMES, CDFILIAL, NRCARDAPIO)
/

-- ================================================================================
-- TABLE: VERCARDACLI
-- ================================================================================
CREATE TABLE VERCARDACLI(
 NRVERCARDACLI 		NUMBER 		NOT NULL,
 NRVERCARDADIA 		NUMBER 		NOT NULL,
 CDCLIENTE 		VARCHAR2(21) 	NOT NULL,
 CDFILIAL 		VARCHAR2(4) 	NOT NULL,
 CDDESTFILI 		VARCHAR2(3) 	NOT NULL,
 QTCOMESTICLI 		FLOAT 		NOT NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCARDACLI 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_VERCARDACLI PRIMARY KEY (NRVERCARDACLI)
)
/

ALTER TABLE VERCARDACLI ADD
	CONSTRAINT FKPLA01194VERCARDADIA FOREIGN KEY (NRVERCARDADIA)
		REFERENCES VERCARDADIA (NRVERCARDADIA) ON DELETE CASCADE
/

CREATE INDEX PLA01194_FK ON VERCARDACLI (NRVERCARDADIA ASC)
/

ALTER TABLE VERCARDACLI ADD
	CONSTRAINT FKPLA01195CLIENTE FOREIGN KEY (CDCLIENTE)
		REFERENCES CLIENTE (CDCLIENTE)
/

CREATE INDEX PLA01195_FK ON VERCARDACLI (CDCLIENTE ASC)
/

ALTER TABLE VERCARDACLI ADD
	CONSTRAINT FKPLA01196DESTFILI FOREIGN KEY (CDFILIAL, CDDESTFILI)
		REFERENCES DESTFILI (CDFILIAL, CDDESTFILI)
/

CREATE INDEX PLA01196_FK ON VERCARDACLI (CDFILIAL ASC, CDDESTFILI ASC)
/

-- ================================================================================
-- TABLE: VERCNFCAMES 
-- ================================================================================
CREATE TABLE VERCNFCAMES (
 NRVERCNFCAMES 		NUMBER 		NOT NULL,
 NRVERCARDAMES 		NUMBER 		NOT NULL,
 NRSEQCNFMES 		NUMBER 		NOT NULL,
 CDTIPOPRAT 		VARCHAR2(2) 	NOT NULL,
 NRORDCNFMES 		NUMBER 		NOT NULL,
 IDOPCCNFMES 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDOPCCNFMES_VERCNFCAMES CHECK (IDOPCCNFMES IN ('S','N')),
 IDIMPCNFMES 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDIMPCNFMES_VERCNFCAMES CHECK (IDIMPCNFMES IN ('S','N')),
 NRPAGCNFMES 		NUMBER 		NULL,
 DSCOMPLTPMES 		VARCHAR2(15) 	NULL,
 IDTPPRATSEGM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATSEGM_VERCNFCAMES CHECK (IDTPPRATSEGM IN ('S','N')),
 IDTPPRATTERM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATTERM_VERCNFCAMES CHECK (IDTPPRATTERM IN ('S','N')),
 IDTPPRATQUAM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATQUAM_VERCNFCAMES CHECK (IDTPPRATQUAM IN ('S','N')),
 IDTPPRATQUIM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATQUIM_VERCNFCAMES CHECK (IDTPPRATQUIM IN ('S','N')),
 IDTPPRATSEXM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATSEXM_VERCNFCAMES CHECK (IDTPPRATSEXM IN ('S','N')),
 IDTPPRATSABM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATSABM_VERCNFCAMES CHECK (IDTPPRATSABM IN ('S','N')),
 IDTPPRATDOMM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATDOMM_VERCNFCAMES CHECK (IDTPPRATDOMM IN ('S','N')),
 IDTPPRATFERM 		VARCHAR2(1) 	NULL
   	CONSTRAINT CKC_IDTPPRATFERM_VERCNFCAMES CHECK (IDTPPRATFERM IN ('S','N')),
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCNFCAMES 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_VERCNFCAMES PRIMARY KEY (NRVERCNFCAMES)
)
/

ALTER TABLE VERCNFCAMES ADD
	CONSTRAINT FKPLA01197VERCARDAMES FOREIGN KEY (NRVERCARDAMES)
		REFERENCES VERCARDAMES (NRVERCARDAMES) ON DELETE CASCADE
/

CREATE INDEX PLA01197_FK ON VERCNFCAMES (NRVERCARDAMES)
/

ALTER TABLE VERCNFCAMES ADD
	CONSTRAINT FKPLA01198TIPOPRAT FOREIGN KEY (CDTIPOPRAT)
		REFERENCES TIPOPRAT (CDTIPOPRAT)
/

CREATE INDEX PLA01198_FK ON VERCNFCAMES (CDTIPOPRAT)
/

CREATE INDEX PLA01199_FK ON VERCNFCAMES (NRVERCARDAMES, NRSEQCNFMES)
/

-- ================================================================================
-- TABLE: VERCOMPCARD
-- ================================================================================
CREATE TABLE VERCOMPCARD(
 NRVERCOMPCARD 	NUMBER 		NOT NULL,
 NRVERCARDAMES 		NUMBER 		NOT NULL,
 NRVERCARDADIA 		NUMBER 		NOT NULL,
 NRVERCNFCAMES 		NUMBER 		NOT NULL,
 CDTIPOPRAT 		VARCHAR2(2) 	NOT NULL,
 CDFILAUXPRAT 		VARCHAR2(4) 	NOT NULL,
 CDPRATO 		VARCHAR2(10) 	NOT NULL,
 VRPECONSCARD 		FLOAT 		NOT NULL,
 CDFILIAL 		VARCHAR2(4) 	NULL,
 NRCARDAPIO 		VARCHAR2(10) 	NULL,
 NRSEQPRATCAR 		NUMBER 		NULL,
 QTCOMEFETPRA 		FLOAT		NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCOMPCARD 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_VERCOMPCARD PRIMARY KEY (NRVERCOMPCARD),
	CONSTRAINT UN_VERCOMPCARD UNIQUE (NRVERCARDAMES, NRVERCARDADIA, NRVERCNFCAMES)
)
/

ALTER TABLE VERCOMPCARD ADD
	CONSTRAINT FKPLA01200VERCARDAMES FOREIGN KEY (NRVERCARDAMES)
		REFERENCES VERCARDAMES (NRVERCARDAMES)
/

CREATE INDEX PLA01200_FK ON VERCOMPCARD (NRVERCARDAMES ASC)
/

ALTER TABLE VERCOMPCARD ADD
	CONSTRAINT FKPLA01201VERCARDADIA FOREIGN KEY (NRVERCARDADIA)
		REFERENCES VERCARDADIA (NRVERCARDADIA)	ON DELETE CASCADE
/

CREATE INDEX PLA01201_FK ON VERCOMPCARD (NRVERCARDADIA ASC)
/

ALTER TABLE VERCOMPCARD ADD
	CONSTRAINT FKPLA01202VERCNFCAMES FOREIGN KEY (NRVERCNFCAMES)
		REFERENCES VERCNFCAMES (NRVERCNFCAMES)	ON DELETE CASCADE
/

CREATE INDEX PLA01202_FK ON VERCOMPCARD (NRVERCNFCAMES ASC)
/

ALTER TABLE VERCOMPCARD ADD
	CONSTRAINT FKPLA01203PRATO FOREIGN KEY (CDFILAUXPRAT, CDPRATO)
		REFERENCES PRATO (CDFILAUXPRAT, CDPRATO)
/

CREATE INDEX PLA01203_FK ON VERCOMPCARD (CDFILAUXPRAT ASC, CDPRATO ASC)
/

ALTER TABLE VERCOMPCARD ADD
	CONSTRAINT FKPLA01204TIPOPRAT FOREIGN KEY (CDTIPOPRAT)
		REFERENCES TIPOPRAT (CDTIPOPRAT)
/

CREATE INDEX PLA01204_FK ON VERCOMPCARD (CDTIPOPRAT ASC)
/

-- ================================================================================
-- TABLE: VERCUSTOPRODUTOCAR
-- ================================================================================
CREATE TABLE VERCUSTOPRODUTOCAR(
 NRVERCUSTOPRODUTOCAR NUMBER 		NOT NULL,
 NRVERCARDAMES 		NUMBER 		NOT NULL,
 CDPRODUTO 		VARCHAR2(10) 	NOT NULL,
 VRCUSTO 		FLOAT		NOT NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCUSTOPRODUTOCAR 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_VERCUSTOPRODUTOCAR PRIMARY KEY (NRVERCUSTOPRODUTOCAR),
	CONSTRAINT UN_VERCUSTOPRODUTOCAR UNIQUE (NRVERCARDAMES, CDPRODUTO)
)
/

ALTER TABLE VERCUSTOPRODUTOCAR ADD
	CONSTRAINT FKPLA01205VERCARDAMES FOREIGN KEY (NRVERCARDAMES)
		REFERENCES VERCARDAMES (NRVERCARDAMES) ON DELETE CASCADE
/

CREATE INDEX PLA01205_FK ON VERCUSTOPRODUTOCAR (NRVERCARDAMES ASC)
/

ALTER TABLE VERCUSTOPRODUTOCAR ADD
	CONSTRAINT FKPLA01206PRODUTO FOREIGN KEY (CDPRODUTO)
		REFERENCES PRODUTO (CDPRODUTO)
/

CREATE INDEX PLA01206_FK ON VERCUSTOPRODUTOCAR (CDPRODUTO ASC)
/

-- ================================================================================
-- TABLE: VERCUSTOPRODUTOCAR
-- ================================================================================
CREATE TABLE VERRECEPRATOCAR(
 NRVERRECEPRATOCAR 	NUMBER 		NOT NULL,
 NRVERCARDAMES 		NUMBER 		NOT NULL,
 CDFILAUXPRAT 		VARCHAR2(4) 	NOT NULL,
 CDPRATO 		VARCHAR2(10) 	NOT NULL,
 CDPRODUTO 		VARCHAR2(10) 	NOT NULL,
 IDTIPORECE 		VARCHAR2(1) 	NOT NULL 
	CONSTRAINT CKC_IDTIPORECE_VERRECEPRATOCAR CHECK (IDTIPORECE IN ('P','F', 'S')),
 QTPRODREC 		FLOAT 		NOT NULL,
 VRPEFATCOC 		FLOAT 		NOT NULL,
 VRPEFATCOR 		FLOAT 		NOT NULL,
 SGUNIDADE 		VARCHAR2(10) 	NOT NULL,
 QTBRUTAUNR		FLOAT 		NOT NULL,
 IDPRODBASE 		VARCHAR2(1) 	DEFAULT 'N' NOT NULL
	CONSTRAINT CKC_IDPRODBASE_VERRECEPRATOCAR CHECK (IDPRODBASE IN ('S','N')),
 IDQTDEFIX 		VARCHAR2(1) 	DEFAULT 'N' NOT NULL
	CONSTRAINT CKC_IDQTDEFIX_VERRECEPRATOCAR CHECK (IDQTDEFIX IN ('S','N')),
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERRECEPRATOCAR 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_VERRECEPRATOCAR PRIMARY KEY (NRVERRECEPRATOCAR),
	CONSTRAINT UN_VERRECEPRATOCAR UNIQUE(NRVERCARDAMES, CDFILAUXPRAT, CDPRATO, CDPRODUTO)
)
/

ALTER TABLE VERRECEPRATOCAR ADD
	CONSTRAINT FKPLA01207VERCARDAMES FOREIGN KEY (NRVERCARDAMES)
		REFERENCES VERCARDAMES (NRVERCARDAMES) ON DELETE CASCADE
/

CREATE INDEX PLA01207_FK ON VERRECEPRATOCAR (NRVERCARDAMES ASC)
/

ALTER TABLE VERRECEPRATOCAR ADD
	CONSTRAINT FKPLA01208PRODUTO FOREIGN KEY (CDPRODUTO)
		REFERENCES PRODUTO (CDPRODUTO)
/

CREATE INDEX PLA01208_FK ON VERRECEPRATOCAR (CDPRODUTO)
/

ALTER TABLE VERRECEPRATOCAR ADD
	CONSTRAINT FKPLA01209PRATO FOREIGN KEY (CDFILAUXPRAT, CDPRATO)
		REFERENCES PRATO (CDFILAUXPRAT, CDPRATO)
/

CREATE INDEX PLA01209_FK ON VERRECEPRATOCAR (CDFILAUXPRAT ASC, CDPRATO ASC)
/

-- ================================================================================
-- TABLE: VERCONSSERV
-- ================================================================================
CREATE TABLE VERCONSSERV(
 NRVERCONSSERV 		NUMBER 		NOT NULL,
 NRVERCARDADIA 		NUMBER 		NOT NULL,
 IDTIPOCONSUMO		VARCHAR2(1) 	NOT NULL
	CONSTRAINT CKC_IDTIPOCONSUMO_VERCONSSERV CHECK (IDTIPOCONSUMO IN ('P','F')),
 CDPRODUTO		VARCHAR2(10) 	NOT NULL,
 QTPRODUTO 		FLOAT 		NOT NULL,
 NRORG                       	NUMBER 		DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
 IDATIVO                    	VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_VERCONSSERV 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_VERCONSSERV PRIMARY KEY (NRVERCONSSERV),
	CONSTRAINT UN_VERCONSSERV UNIQUE (NRVERCARDADIA, IDTIPOCONSUMO, CDPRODUTO)
)
/

ALTER TABLE VERCONSSERV ADD
	CONSTRAINT FKPLA01210VERCARDADIA FOREIGN KEY (NRVERCARDADIA)
		REFERENCES VERCARDADIA (NRVERCARDADIA) ON DELETE CASCADE
/

CREATE INDEX PLA01210_FK ON VERCONSSERV (NRVERCARDADIA ASC)
/


ALTER TABLE VERCONSSERV ADD
	CONSTRAINT FKPLA01211PRODUTO FOREIGN KEY (CDPRODUTO)
		REFERENCES PRODUTO (CDPRODUTO)
/

CREATE INDEX PLA01211_FK ON VERCONSSERV (CDPRODUTO ASC)