ALTER TABLE PLANRECPROD ADD QTPRODLIQ FLOAT
/

CREATE TABLE VALREFDIARIO (
	NRVALREFDIARIO 	  NUMBER NOT NULL, 
	CDFILCENTPME 	  VARCHAR2(4) NOT NULL, 
	CDTIPOCARD 		  VARCHAR2(10) NOT NULL, 
	PERCNECDIARIA 	  FLOAT NOT NULL, 
	NRREFEICAO 		  NUMBER NOT NULL,
	VRENERGIA 		  FLOAT NOT NULL, 
	VRCARBVETMIN 	  FLOAT NOT NULL, 
	VRCARBVETMAX 	  FLOAT NOT NULL, 
	VRCARBENERMIN 	  FLOAT NOT NULL, 
	VRCARBENERMAX 	  FLOAT NOT NULL,
	VRPROTVETMIN 	  FLOAT NOT NULL, 
	VRPROTVETMAX 	  FLOAT NOT NULL, 
	VRPROTENERMIN 	  FLOAT NOT NULL, 
	VRPROTENERMAX 	  FLOAT NOT NULL,
	VRLIPVETMIN 	  FLOAT NOT NULL, 
	VRLIPVETMAX 	  FLOAT NOT NULL, 
	VRLIPENERMIN 	  FLOAT NOT NULL, 
	VRLIPENERMAX 	  FLOAT NOT NULL,
	DSFONTE 		  VARCHAR2(100) NOT NULL,
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    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 CKC_IDATIVO_VALREFDIARIO CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_VALREFDIARIO PRIMARY KEY(CDFILCENTPME, CDTIPOCARD, NRVALREFDIARIO)
)
/

CREATE TABLE REFDIARIOMICRO (
	NRREFDIARIOMICRO  NUMBER NOT NULL,
	NRVALREFDIARIO 	  NUMBER NOT NULL, 
	CDFILCENTPME 	  VARCHAR2(4) NOT NULL, 
	CDTIPOCARD 		  VARCHAR2(10) NOT NULL, 
	CDNUTRIENTE 	  VARCHAR2(3),
	VRENERGIA 		  FLOAT NOT NULL,
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    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 CKC_IDATIVO_REFDIARIOMICRO CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_REFDIARIOMICRO PRIMARY KEY(CDFILCENTPME, CDTIPOCARD, NRVALREFDIARIO, NRREFDIARIOMICRO)
)
/