CREATE TABLE FCT_TIPORESCISAO (
	NRTIPORESCISAO    NUMBER  NOT NULL,
	DSTIPORESCISAO    VARCHAR2 (500),
	NRSEQMODDOCFCT    NUMBER, 
	IDPERMITEDOCX     VARCHAR2 (1)   DEFAULT 'S',
    NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           VARCHAR2(1)    DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_TIPORESCISAO 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'
)
/

ALTER TABLE FCT_TIPORESCISAO ADD CONSTRAINT PK_FCT_TIPORESCISAO PRIMARY KEY (NRTIPORESCISAO)
/

CREATE INDEX SM00329_FK ON FCT_TIPORESCISAO (NRSEQMODDOCFCT ASC)
/

ALTER TABLE FCT_TIPORESCISAO 
      ADD CONSTRAINT FKSM00329FCT_MODELDOC_TPRESC FOREIGN KEY (NRSEQMODDOCFCT)
          REFERENCES FCT_MODELODOC (NRSEQMODDOCFCT)
/

ALTER TABLE FCT_TIPORESCISAO ADD CONSTRAINT CHK_IDPERMITEDOCX_TPRESC CHECK (IDPERMITEDOCX IN ('S', 'N'))
/

ALTER TABLE FCT_TIPORESCISAO ADD CONSTRAINT CHK_IDATIVO_TPRESC CHECK (IDATIVO IN ('S', 'N'))
/

ALTER TABLE FCT_ANEXOCONTRATO MODIFY DSTIPO VARCHAR2(150)
/

ALTER TABLE FCT_CONTRATO ADD NRTIPORESCISAO NUMBER
/

ALTER TABLE FCT_CONTRATO ADD VRPENDENCIAFIN NUMBER
/