CREATE TABLE APRCUSTOPPREV
(
    CDFILIAL            		VARCHAR2(4)            	NOT NULL,
    NRORDPROD           	VARCHAR2(10)           	NOT NULL,
    NRSUBORDPROD        	VARCHAR2(1)            	NOT NULL,
    CDETAPAPROD         	VARCHAR2(10)           	NOT NULL,
    NRAPRCUSTOP         	VARCHAR2(10)           	NOT NULL,
    CDCUSTOINDI         	VARCHAR2(3)            	NULL    ,
    CDFUNCUSTO          	VARCHAR2(3)            	NULL    ,
    NRLOTEESTQ          	VARCHAR2(20)           	NULL    ,
    NRSUBLOTE           	VARCHAR2(4)            	NULL    ,
    CDPRODUTO           	VARCHAR2(10)           	NULL    ,
    CDAPRCUSTOP         	VARCHAR2(20)           	NULL    ,
    NMAPRCUSTOP         	VARCHAR2(60)          	NULL    ,
    QTAPRCUSTOP         	FLOAT                  		NULL    ,
    VRUNICUSTOP         	FLOAT                  		NULL    ,
    VRAPRCUSTOP         	FLOAT                  		NULL    ,
    QTHRAPRCUST         	FLOAT                  		NULL    ,
    CDTIPOPERDA         	VARCHAR2(3)            	NULL    ,
    CDCENTCUST          	VARCHAR2(4)            	NULL    ,
    IDSTATUSCTBOP       	VARCHAR2(1)            	NOT NULL,  
    CDEMPRCTBOP         	VARCHAR2(2),
    CDLOTECTBOP         	VARCHAR2(20),
    DTLANCRETDEV       	DATE, 
    IDSITMATPRIMA       	VARCHAR2(10),
    NRORG                       	NUMBER 			DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO                    	VARCHAR2(1)     		DEFAULT 'S' NOT NULL
        CONSTRAINT CKC_IDATIVO_APRCUSTOPPREV 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',
          CONSTRAINT PK_APRCUSTOPPREV PRIMARY KEY (CDFILIAL, NRORDPROD, NRSUBORDPROD, CDETAPAPROD, NRAPRCUSTOP)
)