CREATE TABLE DREGERESTRU( 
  CDITEMESTRU     VARCHAR2(05)    	NOT NULL, 
  DSCTGESTRU      VARCHAR2(2000)  	NOT NULL, 
  IDTPITEMSTRU    VARCHAR2(1)     	NOT NULL
       CONSTRAINT CKC_IDTPITEMSTRU_DREGERESTRU CHECK (IDTPITEMSTRU IN ('R','D')), 
  IDEXIBITEMSTRU  VARCHAR2(1)     	NOT NULL
         CONSTRAINT CKC_IDEXIBITEMSTRU_DREGERESTRU CHECK (IDEXIBITEMSTRU IN ('S','N')),
  NRORG           NUMBER 			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
  IDATIVO         VARCHAR2(1)   	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_DREGERESTRU 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',
   	CONSTRAINT PK_DREGERESTRU PRIMARY KEY (CDITEMESTRU)
)
/

ALTER TABLE CLASSFINANC ADD CDITEMESTRU VARCHAR2(05) NULL -- CRIAR REFERENCIA COM A TABELA DREGERESTRU
/

ALTER TABLE CLASSFINANC ADD
	CONSTRAINT FKCTB00313DREGERESTRU FOREIGN KEY (CDITEMESTRU)
		REFERENCES DREGERESTRU (CDITEMESTRU)
/

CREATE INDEX CTB00313_FK ON CLASSFINANC (CDITEMESTRU ASC)
/

ALTER TABLE RAZAO ADD IDPART VARCHAR2(1) DEFAULT NULL
	CONSTRAINT CKC_IDPART_RAZAO CHECK (IDPART IN ('S','C','P',NULL))
/

ALTER TABLE RAZAO ADD CDEMPRESA VARCHAR2(2) NULL
/

ALTER TABLE RAZAO ADD CDDOCUCONT VARCHAR2(20) NULL
/

ALTER TABLE RAZAO ADD CDCONTCTBLT VARCHAR2(20) NULL