CREATE TABLE ARQUSPEDECF(
    CDEMPRESA   	  VARCHAR2(2),
    NRSEQARQMAG 	  VARCHAR2(10),
	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_ARQUSPEDECF CHECK (IDATIVO IN ('S','N'))
)
/
CREATE TABLE ARQUSPEDCTB(
	CDEMPRESA 	  VARCHAR2(2) 	  NOT NULL, 
    DTFINAL 		  DATE 			  NOT NULL , 
    NRSEQARQMAG 	  VARCHAR2(10) 	  NOT NULL, 
    NMARQUIVO 		  VARCHAR2(90) 	  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_ARQUSPEDCTB CHECK (IDATIVO IN ('S','N')), 
		 CONSTRAINT PK_ARQUSPEDCTB PRIMARY KEY (CDEMPRESA, DTFINAL)
)
/
