CREATE TABLE PRODPEDXAF
(
 CDFILLANC    		VARCHAR2(4),
 CDFILDEST    		VARCHAR2(4),
 NRAUTOFORN   		VARCHAR2(10),
 CDPRODUTO    		VARCHAR2(10),
 DTPROGENTAF  		DATE,
 CDMARCA      		VARCHAR2(5),
 CDFILIAL     		VARCHAR2(4),
 NRPEDIDO     		VARCHAR2(10),
 NRRELACPEDAF 		VARCHAR2(10),
 NRORG 			 	NUMBER		    DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
 IDATIVO            VARCHAR2(1)   	DEFAULT 'S' 									NOT NULL,
    CONSTRAINT CKC_IDATIVO_PRODPEDXAF CHECK (IDATIVO IN ('S','N')),
 DTINCLUSAO        	DATE                   											NULL,
 DTULTATU          	DATE                 											NULL,
 NRORGINCLUSAO     	NUMBER        	DEFAULT 1 										NULL,
 CDOPERINCLUSAO    	VARCHAR2(12)  	DEFAULT '1' 									NULL,
 NRORGULTATU       	NUMBER        	DEFAULT 1 										NULL,
 CDOPERULTATU 	 	VARCHAR2(12)  	DEFAULT '1'
)
/
ALTER TABLE PRODPEDXAF
  ADD CONSTRAINT FKPED00430RELPRAF FOREIGN KEY (CDFILIAL, NRPEDIDO)
REFERENCES PEDIDO(CDFILIAL, NRPEDIDO) ON DELETE CASCADE