CREATE TABLE PROJMANUALDRF (
    CDFILIAL        VARCHAR2(4) NOT NULL, 
    DTINICIAL       DATE        NOT NULL,
    DTFINAL         DATE        NOT NULL,
    VRFATBRUTODRF   FLOAT       NULL,
    VRIMPOSTODRF    FLOAT       NULL,
    VRFATLIQDRF     FLOAT       NULL,
    VRCONSUMODRF    FLOAT       NULL,
    VRCMVDRF        FLOAT       NULL,
    VRRETEXTRADRF   FLOAT       NULL,
    VRDESGERALDRF   FLOAT       NULL,
    VRDESMAOOBRADRF FLOAT       NULL,
    VRDESINVESTDRF  FLOAT       NULL,
    VRRESULTADODRF  FLOAT       NULL,
    CONSTRAINT PK_PROJMANUALDRF PRIMARY KEY (CDFILIAL, DTINICIAL, DTFINAL),
	NRORG             NUMBER 	      DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO           VARCHAR2(1)     DEFAULT 'S' 									   NOT NULL
      CONSTRAINT CKC_IDATIVO_PROJMANUALDRF 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'
)
/

CREATE INDEX VND00798_FK ON PROJMANUALDRF (CDFILIAL ASC)
/

ALTER TABLE PROJMANUALDRF
   ADD CONSTRAINT FKVND00798FILIAL FOREIGN KEY (CDFILIAL)
      REFERENCES FILIAL (CDFILIAL)
/