ALTER TABLE PEDIDOFOS ADD IDREBUILD VARCHAR2(1) NULL 
/
 
CREATE TABLE PEDIDOALT
( 
	CDFILIALOLD		VARCHAR2(04) 		NOT NULL,
	NRVENDARESTOLD	        VARCHAR2(10) 		NOT NULL,
	NRCOMANDAOLD	        VARCHAR2(10) 		NOT NULL,
	NRPRODCOMVENOLD  	VARCHAR2(06) 		NOT NULL,
	NRVENDAREST		VARCHAR2(10) 		NULL,
	NRCOMANDA		VARCHAR2(10) 		NULL,
	NRPRODCOMVEN	        VARCHAR2(06)		NULL,
	NRMESA			VARCHAR2(04) 		NULL,
	NRSEQPRODCUP	        VARCHAR2(10) 		NULL,
	NRLUGARMESAIT	        VARCHAR2(02) 		NULL,
	NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO	                VARCHAR2(1) DEFAULT 'S'	NOT NULL,
		CONSTRAINT CKC_IDATIVO_EXEMPLO CHECK (IDATIVO IN ('S','N')),
	DTINCLUSAO              DATE          		NULL,
	DTULTATU                DATE          		NULL,
	NRORGINCLUSAO           NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg')        		NULL,
	CDOPERINCLUSAO          VARCHAR2(12)  		NULL,
	NRORGULTATU             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg')       		NULL,
	CDOPERULTATU            VARCHAR2(12)  		NULL,
	CONSTRAINT PK_PEDIDOALT PRIMARY KEY (CDFILIALOLD, NRVENDARESTOLD, NRCOMANDAOLD, NRPRODCOMVENOLD)
)
/