CREATE TABLE ARQXMLNSUCTE (
    NRINSJURPESQ 	VARCHAR2(20) 	NOT NULL ,
    IDTPAMBIENTE 	VARCHAR2(1) 	NOT NULL ,
    NRNSU 			VARCHAR2(15) 	NOT NULL ,
    NRORG 			NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL ,
    DTINCLUSAO 		DATE 			DEFAULT SYSDATE,
    DTULTATU 		DATE 			DEFAULT SYSDATE,
    NRORGINCLUSAO 	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
    CDOPERINCLUSAO 	VARCHAR2(12) 	DEFAULT '1',
    NRORGULTATU 	NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NULL,
    CDOPERULTATU 	VARCHAR2(12) 	DEFAULT '1',
    IDATIVO 		VARCHAR2(1) 	DEFAULT 'S' NOT NULL ,
    CDSERVICO 		VARCHAR2(6),
    DSSERVICO 		VARCHAR2(60),
    IDCONSULTADO 	VARCHAR2(1) 	DEFAULT 'N' NOT NULL ,
    DSARQXMLNSUCTE  CLOB 			NOT NULL ,    
		CONSTRAINT CKC_IDATIVO_ARQXMLNSUCTE CHECK (IDATIVO IN ('S','N')) ,
		CONSTRAINT CKC_IDCONSULTADO_ARQXMLNSUCTE CHECK (IDCONSULTADO IN ('S','N')) ,
		CONSTRAINT CKC_ARQXMLNSUCTE_IDTPAMBIENTE CHECK (IDTPAMBIENTE IN ('1', '2')) ,
		CONSTRAINT PK_ARQXMLNSUCTE PRIMARY KEY (NRINSJURPESQ, IDTPAMBIENTE, NRNSU),
		CONSTRAINT FKFIS00857ARQXMLNSUCTE FOREIGN KEY (NRINSJURPESQ, IDTPAMBIENTE, NRNSU)
			REFERENCES SINCRONIZACAOCTE (NRINSJURPESQ, IDTPAMBIENTE, NRNSU) ON DELETE CASCADE 
)
/

CREATE INDEX FIS00857_FK ON ARQXMLNSUCTE(NRINSJURPESQ ASC, IDTPAMBIENTE ASC, NRNSU ASC)
/ 