ALTER TABLE PARAMORCAOPERAC ADD IDUTILORCAREALOC VARCHAR2(1) NULL
	CONSTRAINT CKC_IDUTILORCAREALOC CHECK (IDUTILORCAREALOC IS NULL OR (IDUTILORCAREALOC IN ('S', 'N')))
/
ALTER TABLE PARAMORCAOPERAC ADD IDREALSUPORCA VARCHAR2(30) NULL
    CONSTRAINT CKC_IDREALSUPORCA CHECK (IDREALSUPORCA IS NULL OR (IDREALSUPORCA IN ('RATEAR_PERIODO','PROXIMO_MES')))
/
ALTER TABLE PARAMORCAOPERAC ADD IDREALINFORCA VARCHAR2(30) NULL
    CONSTRAINT CKC_IDREALINFORCA CHECK (IDREALINFORCA IS NULL OR (IDREALINFORCA IN ('RATEAR_PERIODO','PROXIMO_MES')))
/
ALTER TABLE PARAMORCAOPERAC ADD IDCONSORCREALOC VARCHAR2(1) NULL
	CONSTRAINT CKC_IDCONSORCREALOC CHECK (IDCONSORCREALOC IS NULL OR (IDCONSORCREALOC IN ('S', 'N')))
/
CREATE TABLE ORCAMENTREALOC (
	NRORCAMENTREALOC    NUMBER        													NOT NULL, 
	CDFILIAL            VARCHAR2(4)  													NOT NULL,
	IDTPDEMANDA         VARCHAR2(30)  													NOT NULL
		CONSTRAINT CKC_IDTPDEMANDA_ORCAMENTREALOC CHECK (IDTPDEMANDA IN ('SOLICITACAO', 'AF')),
	IDORIGEM            VARCHAR2(30)          											NOT NULL
		CONSTRAINT CKC_IDORIGEM_ORCAMENTREALOC CHECK (IDORIGEM IS NULL OR (IDORIGEM IN ('CONSUMO', 'DESPESA'))),
	DTMESPERIODO        DATE          													NOT NULL,
	CDNVLARVPROD        VARCHAR2(30)  													NOT NULL,
	CDDESPPREV          VARCHAR2(2)  													NOT NULL,
	VRORCAMENTO         NUMBER        													NULL,
	VRORCAREALOC        NUMBER        													NULL,
	VRREALIZADO         NUMBER        													NULL,
	NRORG               NUMBER        	    DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')	NOT NULL,                                                                                                                                            
	IDATIVO             VARCHAR2(1)   	    DEFAULT 'S'									NOT NULL
		CONSTRAINT CKC_IDATIVO_ORCAMENTREALOC 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_ORCAMENTREALOC PRIMARY KEY (NRORCAMENTREALOC)
)