ALTER TABLE FCT_SIGNATARIOSPADR ADD IDTPSIGNATARIO CHAR(2) DEFAULT 'SE' NOT NULL
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD CONSTRAINT CK_IDTPSIGNATARIO_SIGPAD CHECK(IDTPSIGNATARIO IN ('SC', 'TC', 'SP','TP','SE'))
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD DSEMAILNOTSIGNENV VARCHAR2(50)
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD DSEMAILNOTIFOUTROS VARCHAR2(4000)
/

ALTER TABLE FCT_SIGNATARIOSPADR MODIFY NRPARCNEGOCIO  NULL
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD IDTPSIGNATARIO CHAR(2) DEFAULT 'SE' NOT NULL
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD CONSTRAINT CK_IDTPSIGNATARIO_SIGPADORC CHECK(IDTPSIGNATARIO IN ('SC', 'TC', 'SP','TP','SE'))
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD DSEMAILNOTSIGNENV VARCHAR2(50)
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD DSEMAILNOTIFOUTROS VARCHAR2(4000)
/

ALTER TABLE FCT_SIGNATPADRMODORCA MODIFY NRPARCNEGOCIO NULL
/

ALTER TABLE FCT_SIGNATPADRMODORCA DROP CONSTRAINT FKSM00299FCT_MDORC_SIGPDMDORC
/

ALTER TABLE FCT_SIGNATPADRMODORCA
    ADD CONSTRAINT FKSM00299FCT_MDORC_SIGPDMDORC FOREIGN KEY (NRORCAMENTOMODELO)
      REFERENCES FCT_ORCAMENTOMODELO (NRORCAMENTOMODELO) ON DELETE CASCADE
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD IDTPSIGNATARIO CHAR(2) DEFAULT 'SE' NOT NULL
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD CONSTRAINT CK_IDTPSIGNATARIO_SIGPADCONT CHECK(IDTPSIGNATARIO IN ('SC', 'TC', 'SP','TP','SE'))
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD DSEMAILNOTSIGNENV VARCHAR2(50)
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD DSEMAILNOTIFOUTROS VARCHAR2(4000)
/

ALTER TABLE FCT_SIGNATPADRMODCONT MODIFY NRPARCNEGOCIO NULL
/

ALTER TABLE FCT_SIGNATPADRMODCONT DROP CONSTRAINT FKSM00301FCT_MDCON_SIGPDMDCON
/

ALTER TABLE FCT_SIGNATPADRMODCONT
    ADD CONSTRAINT FKSM00301FCT_MDCON_SIGPDMDCON FOREIGN KEY (NRSEQMODCONTRA)
      REFERENCES FCT_MODELOCONTRATO (NRSEQMODCONTRA) ON DELETE CASCADE
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD DSEMAILNOTSIGNENV VARCHAR2(50)
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD DSEMAILNOTIFOUTROS VARCHAR2(4000)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD DSEMAILNOTSIGNENV VARCHAR2(50)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD DSEMAILNOTIFOUTROS VARCHAR2(4000)
/

CREATE TABLE FCT_RELACOPERNOTIFASSELE (
    NRRELOPERNOTIFASSELE   NUMBER  							NOT NULL,
    NRSIGNATARIOSPADR      NUMBER,
    NRSIGNATPADRORCA       NUMBER,
    NRSIGNATPADRCONT       NUMBER,
    NRASSDIGITALORCA       NUMBER,
    NRASSDIGITALCONTR      NUMBER,
    CDOPERADOR             VARCHAR2(12) 					NOT NULL,
    NRORG             	   NUMBER 	     	DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO           	   VARCHAR2(1)     	DEFAULT 'S' 	NOT NULL
      CONSTRAINT CKC_IDATV_FCT_RELCOPNOTFASSEL 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_RELACOPERNOTIFASSELE ADD CONSTRAINT PK_FCT_RELACOPERNOTIFASSELE PRIMARY KEY (NRRELOPERNOTIFASSELE)
/

CREATE INDEX SM00332_FK ON FCT_RELACOPERNOTIFASSELE (NRSIGNATARIOSPADR ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00332RELOPNOTASEL_SIGP FOREIGN KEY (NRSIGNATARIOSPADR)
      REFERENCES FCT_SIGNATARIOSPADR (NRSIGNATARIOSPADR) ON DELETE CASCADE
/

CREATE INDEX SM00333_FK ON FCT_RELACOPERNOTIFASSELE (NRSIGNATPADRORCA ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00333RELOPNOTASEL_SIGPORC FOREIGN KEY (NRSIGNATPADRORCA)
      REFERENCES FCT_SIGNATPADRMODORCA (NRSIGNATPADRORCA) ON DELETE CASCADE
/

CREATE INDEX SM00334_FK ON FCT_RELACOPERNOTIFASSELE (NRSIGNATPADRCONT ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00334RELOPNOTASEL_SIGPCON FOREIGN KEY (NRSIGNATPADRCONT)
      REFERENCES FCT_SIGNATPADRMODCONT (NRSIGNATPADRCONT) ON DELETE CASCADE
/

CREATE INDEX SM00335_FK ON FCT_RELACOPERNOTIFASSELE (NRASSDIGITALORCA ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00335RELOPNOTASEL_ASSORCA FOREIGN KEY (NRASSDIGITALORCA)
      REFERENCES FCT_ASSINATDIGITALPROP (NRASSDIGITALORCA) ON DELETE CASCADE
/

CREATE INDEX SM00336_FK ON FCT_RELACOPERNOTIFASSELE (NRASSDIGITALCONTR ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00336RELOPNOTASEL_ASSCONT FOREIGN KEY (NRASSDIGITALCONTR)
      REFERENCES FCT_ASSINATDIGITALCONTR (NRASSDIGITALCONTR) ON DELETE CASCADE
/

CREATE INDEX SM00337_FK ON FCT_RELACOPERNOTIFASSELE (CDOPERADOR ASC)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE
    ADD CONSTRAINT FKSM00337RELOPNOTASEL_OPER FOREIGN KEY (CDOPERADOR)
      REFERENCES OPERADOR (CDOPERADOR)
/

ALTER TABLE FCT_RELACOPERNOTIFASSELE ADD CONSTRAINT CK_IDATIVO_RELOPERNOTASSELE CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_ORCAMENTOMODELO ADD IDENVIADOCCONCLUSAO CHAR(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE FCT_ORCAMENTOMODELO ADD CONSTRAINT CK_IDENVIADOCCONCLUSAO CHECK(IDENVIADOCCONCLUSAO IN ('S','N'))
/