CREATE TABLE ITCMD_LOG (
    CDFILIAL         VARCHAR2(4)   NOT NULL,
    NRVENDAREST      VARCHAR2(10)  NOT NULL,
    NRCOMANDA        VARCHAR2(10)  NOT NULL,
    NRPRODCOMVEN     VARCHAR2(6)   NOT NULL,
    CDPRODUTO        VARCHAR2(10)  NOT NULL,
    QTPRODCOMVEN     FLOAT         NULL,
    VRPRECCOMVEN     FLOAT         NULL,
    VRDESCCOMVEN     FLOAT         NULL,
    VRACRCOMVEN      FLOAT         NULL,
    DTHRINCOMVEN     DATE          NOT NULL,
    CDCAIXACOLETOR   VARCHAR2(3)   NULL,
    CDSENHAPED       VARCHAR2(5)   NULL,
    IDEXPREGISTRO    VARCHAR2(1)   NOT NULL,
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        DATE            DEFAULT SYSDATE,
    DTULTATU          DATE            DEFAULT SYSDATE,
    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',
		CONSTRAINT CKC_IDATIVO_ITCMD_LOG CHECK (IDATIVO IN ('S','N'))
)
/
CREATE TABLE CMD_LOG(
    CDFILIAL      	  VARCHAR2(4)   NOT NULL,
    NRVENDAREST   	  VARCHAR2(10)  NOT NULL,
    NRCOMANDA         VARCHAR2(10)  NOT NULL,
    DSCOMANDA     	  VARCHAR2(50)  NOT NULL,
    DSHOST        	  VARCHAR2(200) NULL,
    IDOPERAC      	  VARCHAR2(1)   NOT NULL,
    DSAPP         	  VARCHAR2(200) NULL,
    DTHRREGISTRO  	  DATE          NOT NULL,
    IDEXPREGISTRO 	  VARCHAR2(1)   NOT NULL,
    DSTEXT        	  VARCHAR2(2000) NULL,
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        DATE            DEFAULT SYSDATE,
    DTULTATU          DATE            DEFAULT SYSDATE,
    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',
		CONSTRAINT CKC_IDATIVO_CMD_LOG CHECK (IDATIVO IN ('S','N'))
)
/