CREATE TABLE PDCFLUXO
(
    CDEMPRESA	            VARCHAR2(2)        		NOT NULL,
    MENSAL	            	VARCHAR2(40)        	NOT NULL,
    MENSAL_ORDER            VARCHAR2(40)       		NOT NULL,
    TVRPAGAR                NUMBER,
    TVRPAGPREV              NUMBER,
    TVRPAGEFET              NUMBER,
    TVRRECEBER              NUMBER,
    TVRRECPREV              NUMBER,
    TVRRECEFET              NUMBER,
    TVRCREDITO              NUMBER,
    TVRDEBITO               NUMBER,
    TSALDO_CONTACORR        NUMBER,
    TSALDODIA               NUMBER, 
    TSALDODIAREAL           NUMBER,
    TACUMULATIVO            NUMBER,
    TACUMULATIVOREAL        NUMBER,
    TCAPITALGIRO            NUMBER,
    NRORG                   NUMBER 			DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO                 VARCHAR2(1)     		DEFAULT 'S' NOT NULL
    CONSTRAINT CKC_IDATIVO_PDCFLUXO 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 TABLE TMP_PDCFLUXO
(
    CDEMPRESA	            VARCHAR2(2),
    DATAFLUXO               DATE,
    VRPAGAR                 NUMBER,
    VRPAGPREV               NUMBER,
    VRPAGEFET               NUMBER,
    VRRECEBER               NUMBER,
    VRRECPREV               NUMBER,
    VRRECEFET               NUMBER,
    VRCREDITO               NUMBER,
    VRDEBITO                NUMBER,
    SALDO_CONTACORR         NUMBER,
    NRORG                   NUMBER 			DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO                 VARCHAR2(1)     		DEFAULT 'S' NOT NULL
    CONSTRAINT CKC_IDATIVO_TMP_PDCFLUXO 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'
)
/