CREATE TABLE CONTROLSENHAECOMMERCE 
(
    DSEMAILECOMMERCE 	VARCHAR2(100) NOT NULL,
    DSTOKEN 			VARCHAR2(100) NOT NULL,
    DTREQUISICAO 		DATE NOT NULL,
    DTREDEFINICAO 		DATE,
    CDOPERFORN 			VARCHAR2(12),
	NRORG               NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO             VARCHAR2(1) DEFAULT 'S' NOT NULL  CONSTRAINT CKC_IDATIVO_CONTROLSENHAECOM 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'
)
/

CREATE TABLE DM_TRACKING_AF (
       CDFILDEST           VARCHAR2(4),
       NMFILIAL            VARCHAR2(50),
       CDFILLANC           VARCHAR2(4), 
       CDFILCENTCMP        VARCHAR2(4),
       NRAUTOFORN          VARCHAR2(10),
       CDOPERADOR          VARCHAR2(12),
       NMOPERADOR          VARCHAR2(50),
       DTAUTOFORN          DATE,
       VRTOTALAF           FLOAT,
       DTPROGENTAF         DATE,
       IDBAIXAAF           VARCHAR2(1),
       IDTIPOLANCAF        VARCHAR2(1), 
       IDAFEXPIRADA        VARCHAR2(1),
       IDITAFMIGRADA       VARCHAR2(1),
       IDAUTOFORNEX        VARCHAR2(1),
       IDSITUATENDIMENTOAF VARCHAR2(1),
       TXJUSTIFICRECAF     VARCHAR2(2000),
       DTCONFATENDIMENTOAF DATE,
       IDCONFRECEBIMENTO   VARCHAR2(1),
       DTCONFRECEBIMENTO   DATE,
       CDOPERCONFAF        VARCHAR2(12),
       NMOPERCONFAF        VARCHAR2(40),
       NMPAIS              VARCHAR2(30),
       SGESTADO            VARCHAR2(2),
       NMESTADO            VARCHAR2(30),
       NMREGIAOGEO         VARCHAR2(30),
       NMMUNICIPIO         VARCHAR2(30),
       CDFORNECED          VARCHAR2(21),
       NRINSJURFORN        VARCHAR2(20),
       NMRAZSOCFORN        VARCHAR2(100),
       NMFANTFORN          VARCHAR2(40),
       CDFILLANNF          VARCHAR2(4),
       NRLANCTONF          VARCHAR2(10),
       NRNOTAFISC          VARCHAR(20),
       DTEMISSAO           DATE, 
       DTENTRSAID          DATE,
       VRNOTAFISC          FLOAT,
       NRACESSONFE         VARCHAR2(50),
       VRPBRUTOVOLU        FLOAT,
       VRPLIQUVOLU         FLOAT,
       IDTPNOTAFISCAL      NUMBER,
       NMOPERLANCNF        VARCHAR2(100),
       NRATRASOLANCNF      FLOAT,
       NRORG               NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
       IDATIVO             VARCHAR2(1) DEFAULT 'S' NOT NULL  CONSTRAINT CKC_IDATIVO_DMTRACAF 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'
	)
/

CREATE TABLE LOG_ETL_TRACKING(
   CDOPERADOR     VARCHAR2(12),
   DTSTART        DATE, 
   DTEND          DATE,
   DTPARAMINI     DATE,
   DTPARAMFIN     DATE,
   CDFILCENTCMP   VARCHAR2(4),
   NRORG          NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO        VARCHAR2(1) DEFAULT 'S' NOT NULL  CONSTRAINT CKC_IDATIVO_LOGETLTRAC 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'
)
/