ALTER TABLE ITCOMBGRUPOTPPRAT ADD PERCENTREDUCAO FLOAT NULL 
/ 

ALTER TABLE UTILPRATOSERV ADD IDUTILPRATOSERVFERI VARCHAR2(30) DEFAULT 'RESTRICAO' NOT NULL
/

ALTER TABLE UTILPRATOSERV ADD CONSTRAINT CKC_IDUTILPRATOSERVFERI CHECK (IDUTILPRATOSERVFERI IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO'))
/

ALTER TABLE UTILPRATOSERV ADD IDUTILPRATOSERVPRIM VARCHAR2(30) DEFAULT 'RESTRICAO' NOT NULL
/

ALTER TABLE UTILPRATOSERV ADD CONSTRAINT CKC_IDUTILPRATOSERVPRIM CHECK (IDUTILPRATOSERVPRIM IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO'))
/

ALTER TABLE UTILPRATOSERV ADD IDUTILPRATOSERVULT VARCHAR2(30) DEFAULT 'RESTRICAO' NOT NULL
/

ALTER TABLE UTILPRATOSERV ADD CONSTRAINT CKC_IDUTILPRATOSERVULT CHECK (IDUTILPRATOSERVULT IN ('RESTRICAO', 'PREFERENCIAL','OBRIGATORIO'))
/

ALTER TABLE CONFCARD ADD IDUTILPERCENTCONS VARCHAR2(30) DEFAULT 'HISTORICO' NOT NULL 
/

ALTER TABLE CONFCARD ADD CONSTRAINT CKC_IDPERCENTCONS CHECK (IDUTILPERCENTCONS IN ('HISTORICO', 'ATRATIVIDADE'))
/

CREATE TABLE INGREDIENTEPRINC (
	NRINGREDIENTEPRINC  NUMBER    		NULL,
	NMINGREDIENTEPRINC  VARCHAR2(100)	NULL,
	NRORG 				NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 	NOT NULL,
	IDATIVO 			VARCHAR2(1) 	DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_INGREDPRINC 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_INGREDIENTEPRINC PRIMARY KEY (NRINGREDIENTEPRINC)    
)
/


CREATE TABLE ATRATIVIDADEPRATO (
	NRATRATIVIDADEPRATO       	NUMBER 			NOT NULL,
	CDFILIAL 					VARCHAR2(4) 	NOT NULL,
	NMATRATIVIDADEPRATO   	    VARCHAR2(100) 	NOT NULL,
	VRPESOATRATIVIDADE          FLOAT(126) 		NOT NULL,
	NRORG 				        NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO 			        VARCHAR2(1) 	DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_ATRATIVIDADEPRATO 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_ATRATIVIDADEPRATO PRIMARY KEY (NRATRATIVIDADEPRATO)    
)
/

CREATE INDEX PLA01232_FK ON ATRATIVIDADEPRATO (CDFILIAL ASC)
/

ALTER TABLE ATRATIVIDADEPRATO ADD 
	CONSTRAINT FKPLA01232FILIAL FOREIGN KEY (CDFILIAL) 
		REFERENCES FILIAL(CDFILIAL)
/

ALTER TABLE PARAMPRATFILIAL ADD NRINGREDIENTEPRINC1 NUMBER NULL
/

CREATE INDEX PLA01233_FK ON PARAMPRATFILIAL (NRINGREDIENTEPRINC1 ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01233INGRPRINC FOREIGN KEY (NRINGREDIENTEPRINC1) 
		REFERENCES INGREDIENTEPRINC(NRINGREDIENTEPRINC)
/

ALTER TABLE PARAMPRATFILIAL ADD NRINGREDIENTEPRINC2 NUMBER NULL
/

CREATE INDEX PLA01234_FK ON PARAMPRATFILIAL (NRINGREDIENTEPRINC2 ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01234INGRPRINC FOREIGN KEY (NRINGREDIENTEPRINC2) 
		REFERENCES INGREDIENTEPRINC(NRINGREDIENTEPRINC)
/

ALTER TABLE PARAMPRATFILIAL ADD CDAPRERECE VARCHAR2(3) NULL
/

CREATE INDEX PLA01235_FK ON PARAMPRATFILIAL (CDAPRERECE ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01235APRERECE FOREIGN KEY (CDAPRERECE) 
		REFERENCES APRERECE(CDAPRERECE)
/

ALTER TABLE PARAMPRATFILIAL ADD NRFORMAPREPARO NUMBER NULL
/

CREATE INDEX PLA01236_FK ON PARAMPRATFILIAL (NRFORMAPREPARO ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01236FORMAPREPARO FOREIGN KEY (NRFORMAPREPARO) 
		REFERENCES FORMAPREPARO(NRFORMAPREPARO)
/

ALTER TABLE PARAMPRATFILIAL ADD IDATRATIVIDADE VARCHAR2(30) DEFAULT 'ALTA' NOT NULL
/

ALTER TABLE PARAMPRATFILIAL ADD CONSTRAINT CKC_IDATRATIVIDADE CHECK (IDATRATIVIDADE IN ('ALTA', 'MEDIA', 'BAIXA'))
/

ALTER TABLE PARAMPRATFILIAL ADD NRATRATIVIDADEPRATO NUMBER NULL
/

CREATE INDEX PLA01237_FK ON PARAMPRATFILIAL (NRATRATIVIDADEPRATO ASC)
/

ALTER TABLE PARAMPRATFILIAL ADD 
	CONSTRAINT FKPLA01237ATRATIVPRATO FOREIGN KEY (NRATRATIVIDADEPRATO) 
		REFERENCES ATRATIVIDADEPRATO(NRATRATIVIDADEPRATO)
/

CREATE TABLE CENARIOCARD (
	NRCENARIOCARD			NUMBER 			NOT NULL,
	DTCENARIOCARD			DATE 			NOT NULL,
	CDFILIAL				VARCHAR2(4) 	NOT NULL,
	CDSERVFILI				VARCHAR2(5) 	NOT NULL,
	DTMESCARD				DATE 			NOT NULL,
	CDOPERADOR				VARCHAR2(12) 	NOT NULL,
	JSONCENARIO				CLOB 			NOT NULL,
	JSONCARDAPIO			CLOB 			NOT NULL,
	VRCUSTPADR				FLOAT(126) 		NOT NULL,
	VRPUCENARIO				FLOAT(126) 		NOT NULL,
	NRORG					NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO					VARCHAR2(1) 	DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_CENARIOCARD 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_CENARIOCARD PRIMARY KEY (NRCENARIOCARD)    
)
/

CREATE INDEX PLA01238_FK ON CENARIOCARD (CDFILIAL ASC)
/

ALTER TABLE CENARIOCARD ADD 
	CONSTRAINT FKPLA01238FILIAL FOREIGN KEY (CDFILIAL) 
		REFERENCES FILIAL(CDFILIAL)
/

CREATE INDEX PLA01239_FK ON CENARIOCARD (CDFILIAL ASC, CDSERVFILI ASC)
/

ALTER TABLE CENARIOCARD ADD 
	CONSTRAINT FKPLA01239SERVICO FOREIGN KEY (CDFILIAL, CDSERVFILI) 
		REFERENCES SERVICO(CDFILIAL, CDSERVFILI)
/

CREATE INDEX PLA01240_FK ON CENARIOCARD (CDOPERADOR ASC)
/

ALTER TABLE CENARIOCARD ADD 
	CONSTRAINT FKPLA01240OPERADOR FOREIGN KEY (CDOPERADOR) 
		REFERENCES OPERADOR(CDOPERADOR)