CREATE TABLE NSUNFE(
   NRINSJURIEST    VARCHAR2(20)                      NOT NULL,
   NRORG 	       NUMBER DEFAULT 	 SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO         VARCHAR2(1)     DEFAULT 'S' 		 NOT NULL
      CONSTRAINT CKC_IDATIVO_NSUNFE CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO      DATE                   			 NULL,
   DTULTATU        DATE                  			 NULL,
   NRORGINCLUSAO   NUMBER         DEFAULT 1 		 NULL,
   CDOPERINCLUSAO  VARCHAR2(12)   DEFAULT '1' 		 NULL,
   NRORGULTATU     NUMBER    	  DEFAULT 1 		 NULL,
   CDOPERULTATU    VARCHAR2(12)   DEFAULT '1',
   IDAMBIENTENFE   VARCHAR2(1)                       NOT NULL
      CONSTRAINT CKC_NSUNFE_IDAMBIENTENFE CHECK (IDAMBIENTENFE IN ('1', '2')),
   NRNSU           VARCHAR2(15)                      NOT NULL,
   DTINSNRNSU      DATE           DEFAULT SYSDATE    NOT NULL,
   DTUPDNRNSU      DATE           DEFAULT SYSDATE    NOT NULL,
   NRACESSONFE     VARCHAR2(50),
   CDSTATUS        VARCHAR2(03), 
   DSMOTIVO        VARCHAR2(255),
   CDSERVICO       VARCHAR2(06),
   NRSEQSERVICO    VARCHAR2(02),
   DSSERVICO       VARCHAR2(60),
   IDCONSULTADO    VARCHAR2(01)   DEFAULT 'N'       NOT NULL
      CONSTRAINT CKC_NSUNFE_IDCONSULTADO CHECK (IDCONSULTADO IN ('N', 'S')),
   DTRECBTO        DATE,
   NRPROTOCOLO     VARCHAR2(15),
   IDSTATUSNFE     VARCHAR2(01),
      CONSTRAINT CKC_NSUNFE_IDSTATUSNFE CHECK (IDSTATUSNFE IN ('1', '2', '3')),
   IDNRNSUFALTANTE VARCHAR2(01)    DEFAULT 'N'       NOT NULL
      CONSTRAINT CKC_NSUNFE_IDNRNSUFALTANTE CHECK (IDNRNSUFALTANTE IN ('N', 'S')),
   CONSTRAINT PK_NSUNFE PRIMARY KEY (NRINSJURIEST, IDAMBIENTENFE, NRNSU)
)