CREATE TABLE INFDOCFISCREFE(
   CDFILIAL         VARCHAR2(04) NOT NULL,
   NRLANCTONF       VARCHAR2(10) NOT NULL,
   NRSEQDOCFISCREFE NUMBER,
   IDTPDOCREFE      VARCHAR2(06) NOT NULL
      CONSTRAINT CKC_IDTPDOCREFE CHECK (IDTPDOCREFE IN ('refNFe', 'refNF', 'refNFP', 'refCTe', 'refECF')),
   CDREFNFE         VARCHAR2(44),
   CDCUF            VARCHAR2(02),
   DTEMISSAO        DATE,
   NRINSJUREMITDOC  VARCHAR2(14),
   NRIE             VARCHAR2(14), 
   CDMOD            VARCHAR2(02),
   CDSERIE          VARCHAR2(03),
   NRNF             VARCHAR2(09),
   CDREFCTE         VARCHAR2(44),
   NRNECF           VARCHAR2(03),
   NRNCOO           VARCHAR2(06),
      CONSTRAINT PK_INFDOCFISCREFE PRIMARY KEY (CDFILIAL, NRLANCTONF, NRSEQDOCFISCREFE),
   NRORG             NUMBER 	     DEFAULT         	SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' 		NOT NULL,
      CONSTRAINT CKC_IDATIVO_INFDOCFISCREFE 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'
)
/