CREATE TABLE LOGPREPARAORCAGOP(
	NRLOGPREPARAORCAGOP		NUMBER        												NOT NULL,
	NRANOORCAGOP        	NUMBER        												NOT NULL,
	IDPERIODOORCA       	VARCHAR2(30)  												NOT NULL	
		CONSTRAINT CKC_IDPERIODOORCA_LOGPREPARA CHECK (IDPERIODOORCA IN ('MENSAL', 'BIMESTRAL', 'TRIMESTRAL', 'QUADRIMESTRAL', 'SEMESTRAL', 'ANUAL')),
	NRPERIODOORCA       	NUMBER        												NOT NULL,
	CDFILIAL            	VARCHAR2(04)  												NOT NULL,
        DSMOTIVO            VARCHAR2(4000)                               				NULL,
	NRORG               	NUMBER        	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')	NOT NULL,
	IDATIVO             	VARCHAR2(1)   	DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_LOGPREPARAORCAGOP 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_LOGPREPARAORCAGOP PRIMARY KEY (NRLOGPREPARAORCAGOP)
)
/
ALTER TABLE CONCPREORCAGOP MODIFY NRCALENPREORCAGOP NUMBER NULL
/
ALTER TABLE CONCPREORCAGOP ADD NRORCAMENTOGOP NUMBER NULL
/
ALTER TABLE APROVAORCAGOP DROP CONSTRAINT FKGOP00695ORCAMENTOGOP