CREATE TABLE PARAMTRCKIDACS  
( 
	CDEMPRESA 			VARCHAR2(2), 
	CDFILIAL 			VARCHAR2(4),
	CDUSUARIO 			VARCHAR2(20),
	CDSENHA 			VARCHAR2(250),
	CDOPERADOR 			VARCHAR2(12),
	NRORG           	NUMBER 	      DEFAULT         	SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO         	VARCHAR2(1)     DEFAULT 'S' 	  	NOT NULL
		CONSTRAINT CKC_IDATIVO_PARAMTRCKIDACS CHECK (IDATIVO IN ('S','N')),
    DTINCLUSAO        DATE                  			NULL,
    DTULTATU          DATE                  			NULL,
    NRORGINCLUSAO     NUMBER          					NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
    NRORGULTATU       NUMBER         					NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/
CREATE TABLE CONTTRCKIDACS
( 
	NRCTRLTRCKIDACS 		NUMBER NOT NULL,
	DSTRACKINGID 			VARCHAR2(50),
	DSCONTTRCKIDACS 		CLOB,
	NRORG 					NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
	IDATIVO         		VARCHAR2(1)     DEFAULT 'S' 	  	NOT NULL
		CONSTRAINT CKC_IDATIVO_CONTTRCKIDACS CHECK (IDATIVO IN ('S','N')),
	DTINCLUSAO 				DATE,
	DTULTATU 				DATE,
	NRORGINCLUSAO 			NUMBER  NULL,
	CDOPERINCLUSAO 			VARCHAR2(12 ) DEFAULT '1',
	NRORGULTATU 			NUMBER  NULL,
	CDOPERULTATU 			VARCHAR2(12 ) DEFAULT '1',
		CONSTRAINT PK_CONTTRCKIDACS PRIMARY KEY (NRCTRLTRCKIDACS)
)
/
ALTER TABLE CTRLTRCKIDACS ADD IDTPARQUIVO VARCHAR2(01) NULL
/
ALTER TABLE CTRLTRCKIDACS ADD CDEMPRESA VARCHAR2(04) NULL
/
ALTER TABLE CTRLTRCKIDACS ADD CDFILIAL VARCHAR2(04) NULL
/
ALTER TABLE CTRLTRCKIDACS ADD CDOPERADOR VARCHAR2(12) NULL
/
ALTER TABLE CTRLTRCKIDACS ADD IDSTATIMPORT VARCHAR2(01) DEFAULT 'P' NOT NULL
	CONSTRAINT CKC_IDSTATIMPORT_CTRLTRCKIDACS CHECK (IDSTATIMPORT IN ('P' ,'C', 'E'))
/