ALTER TABLE FCT_PARAMETROGERAL ADD DSTOKENCERTSIGN VARCHAR2(100)
/

CREATE TABLE FCT_SIGNATARIOSPADR (
    NRSIGNATARIOSPADR  NUMBER  NOT NULL,
    NRPARCNEGOCIO      NUMBER  NOT NULL, 
    IDTIPOASSINATURA   CHAR(1) DEFAULT 'E' NOT NULL,
    IDTESTEMUNHA       CHAR(1) DEFAULT 'N' NOT NULL,
    NRORDENACAO        NUMBER  NOT NULL,
    IDINSERCAOAUTO     CHAR(1) DEFAULT 'P' NOT NULL,
       NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_SIGNATSPADR 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_SIGNATARIOSPADR ADD CONSTRAINT PK_FCT_SIGNATARIOSPADR PRIMARY KEY (NRSIGNATARIOSPADR)
/

CREATE INDEX SM00298_FK ON FCT_SIGNATARIOSPADR(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_SIGNATARIOSPADR
    ADD CONSTRAINT FKSM00298PN_FCT_SIGNATPADR FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD CONSTRAINT CK_IDTIPOASSINATURA CHECK(IDTIPOASSINATURA IN ('E','D'))
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD CONSTRAINT CK_IDTESTEMUNHA CHECK(IDTESTEMUNHA IN ('S','N'))
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD CONSTRAINT CK_IDATIVO_SIGPADR CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_SIGNATARIOSPADR ADD CONSTRAINT CK_IDINSERCAOAUTO CHECK(IDINSERCAOAUTO IN ('P','C', 'A'))
/

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

ALTER TABLE FCT_ORCAMENTOMODELO ADD CONSTRAINT CK_IDASSELETRDIGITAL_MODORCA CHECK(IDASSELETRDIGITAL IN ('S','N'))
/

CREATE TABLE FCT_SIGNATPADRMODORCA (
    NRSIGNATPADRORCA   NUMBER  NOT NULL,
    NRORCAMENTOMODELO  NUMBER  NOT NULL,
    NRPARCNEGOCIO      NUMBER  NOT NULL, 
    IDTIPOASSINATURA   CHAR(1) DEFAULT 'E' NOT NULL,
    IDTESTEMUNHA       CHAR(1) DEFAULT 'N' NOT NULL,
    NRORDENACAO        NUMBER  NOT NULL,
    NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_SIGNPADMODORC 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_SIGNATPADRMODORCA ADD CONSTRAINT PK_FCT_SIGNATPADRMODORCA PRIMARY KEY (NRSIGNATPADRORCA)
/

CREATE INDEX SM00299_FK ON FCT_SIGNATPADRMODORCA(NRORCAMENTOMODELO ASC)
/

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

CREATE INDEX SM00300_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_SIGNATPADRMODORCA
    ADD CONSTRAINT FKSM00300PN_FCT_SIGNPADRMDORC FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD CONSTRAINT CK_IDTIPOASSINATURA_MODORCA CHECK(IDTIPOASSINATURA IN ('E','D'))
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD CONSTRAINT CK_IDTESTEMUNHA_MODORCA CHECK(IDTESTEMUNHA IN ('S','N'))
/

ALTER TABLE FCT_SIGNATPADRMODORCA ADD CONSTRAINT CK_IDATIVO_SIGPADRMODORCA CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_MODELOCONTRATO ADD IDASSELETRDIGITAL CHAR(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE FCT_MODELOCONTRATO ADD CONSTRAINT CK_IDASSELETRDIGITAL_MODCONT CHECK(IDASSELETRDIGITAL IN ('S','N'))
/

CREATE TABLE FCT_SIGNATPADRMODCONT (
    NRSIGNATPADRCONT   NUMBER  NOT NULL,
    NRSEQMODCONTRA     NUMBER  NOT NULL,
    NRPARCNEGOCIO      NUMBER  NOT NULL, 
    IDTIPOASSINATURA   CHAR(1) DEFAULT 'E' NOT NULL,
    IDTESTEMUNHA       CHAR(1) DEFAULT 'N' NOT NULL,
    NRORDENACAO        NUMBER  NOT NULL,
    NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_SIGPADMODCONT 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_SIGNATPADRMODCONT ADD CONSTRAINT PK_FCT_SIGNATPADRMODCONT PRIMARY KEY (NRSIGNATPADRCONT)
/

CREATE INDEX SM00301_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

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

CREATE INDEX SM00302_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_SIGNATPADRMODCONT
    ADD CONSTRAINT FKSM00302PN_FCT_SIGNPDRMDCONT FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD CONSTRAINT CK_IDTIPOASSINATURA_MODCONT CHECK(IDTIPOASSINATURA IN ('E','D'))
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD CONSTRAINT CK_IDTESTEMUNHA_MODCONT CHECK(IDTESTEMUNHA IN ('S','N'))
/

ALTER TABLE FCT_SIGNATPADRMODCONT ADD CONSTRAINT CK_IDATIVO_SIGPADRMODCONT CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_ORCAMENTO ADD IDASSELETRDIGITAL CHAR(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE FCT_ORCAMENTO ADD CONSTRAINT CK_IDASSELETRDIGITAL_ORCA CHECK(IDASSELETRDIGITAL IN ('S','N'))
/

CREATE TABLE FCT_ASSINATDIGITALPROP (
    NRASSDIGITALORCA   NUMBER  NOT NULL,
    NRSEQORCAMENTO     NUMBER  NOT NULL,
    NRPARCNEGOCIO      NUMBER  NULL,
    NRSEQINTERLOCUTOR  NUMBER  NULL, 
    NRCPFSIGNATARIO    VARCHAR2(20) NOT NULL, 
    IDTIPOASSINATURA   CHAR(1) DEFAULT 'E' NOT NULL,
    IDTESTEMUNHA       CHAR(1) DEFAULT 'N' NOT NULL,
    NRORDENACAO        NUMBER  NOT NULL,
    IDSITUACAO         CHAR(1) DEFAULT 'P' NOT NULL,
    NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_ASSDIGIPROP 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_ASSINATDIGITALPROP ADD CONSTRAINT PK_FCT_ASSINATDIGITALPROP PRIMARY KEY (NRASSDIGITALORCA)
/

CREATE INDEX SM00303_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALPROP
    ADD CONSTRAINT FKSM00303FCT_ORCA_ASSORCA FOREIGN KEY (NRSEQORCAMENTO)
      REFERENCES FCT_ORCAMENTO (NRSEQORCAMENTO)
/

CREATE INDEX SM00304_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALPROP
    ADD CONSTRAINT FKSM00304PARNEG_FCT_ASSORCA FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

CREATE INDEX SM00305_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALPROP
    ADD CONSTRAINT FKSM00305CRM_INTLOC_FCT_ASSORC FOREIGN KEY (NRSEQINTERLOCUTOR)
      REFERENCES CRM_INTERLOCUTOR (NRSEQINTERLOCUTOR)
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD CONSTRAINT CK_IDTIPOASSINATURA_ORCA CHECK(IDTIPOASSINATURA IN ('E','D'))
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD CONSTRAINT CK_IDTESTEMUNHA_ORCA CHECK(IDTESTEMUNHA IN ('S','N'))
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD CONSTRAINT CK_IDATIVO_ASSINAORCA CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_ASSINATDIGITALPROP ADD CONSTRAINT CK_IDSITUACAO_ORCA CHECK(IDSITUACAO IN ('P','A', 'R', 'M'))
/

ALTER TABLE FCT_CONTRATO ADD IDASSELETRDIGITAL CHAR(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CK_IDASSELETRDIGITAL_CONT CHECK(IDASSELETRDIGITAL IN ('S','N'))
/

CREATE TABLE FCT_ASSINATDIGITALCONTR (
    NRASSDIGITALCONTR  NUMBER  NOT NULL,
    NRSEQCONTRATO      NUMBER  NOT NULL,
    NRPARCNEGOCIO      NUMBER  NULL, 
    NRSEQINTERLOCUTOR  NUMBER  NULL,
    NRCPFSIGNATARIO    VARCHAR2(20) NOT NULL, 
    IDTIPOASSINATURA   CHAR(1) DEFAULT 'E' NOT NULL,
    IDTESTEMUNHA       CHAR(1) DEFAULT 'N' NOT NULL,
    NRORDENACAO        NUMBER  NOT NULL,
    IDSITUACAO         CHAR(1) DEFAULT 'P' NOT NULL,
    NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_ASSDIGICONTR 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_ASSINATDIGITALCONTR ADD CONSTRAINT PK_FCT_ASSINATDIGITALCONTR PRIMARY KEY (NRASSDIGITALCONTR)
/

CREATE INDEX SM00306_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR
    ADD CONSTRAINT FKSM00306FCT_CONTR_ASSCONT FOREIGN KEY (NRSEQCONTRATO)
      REFERENCES FCT_CONTRATO (NRSEQCONTRATO)
/

CREATE INDEX SM00307_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR
    ADD CONSTRAINT FKSM00307PN_FCT_ASSCONT FOREIGN KEY (NRPARCNEGOCIO)
      REFERENCES PARCNEGOCIO (NRPARCNEGOCIO)
/

CREATE INDEX SM00308_FK ON FCT_SIGNATPADRMODORCA(NRPARCNEGOCIO ASC)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR
    ADD CONSTRAINT FKSM00308CRM_INTLOC_FCT_ASSCON FOREIGN KEY (NRSEQINTERLOCUTOR)
      REFERENCES CRM_INTERLOCUTOR (NRSEQINTERLOCUTOR)
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD CONSTRAINT CK_IDTIPOASSINATURA_CONT CHECK(IDTIPOASSINATURA IN ('E','D'))
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD CONSTRAINT CK_IDTESTEMUNHA_CONT CHECK(IDTESTEMUNHA IN ('S','N'))
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD CONSTRAINT CK_IDATIVO_ASSINACONT CHECK(IDATIVO IN ('S','N'))
/

ALTER TABLE FCT_ASSINATDIGITALCONTR ADD CONSTRAINT CK_IDSITUACAO_CONT CHECK(IDSITUACAO IN ('P','A', 'R', 'M'))
/

ALTER TABLE CRM_INTERLOCUTOR ADD IDTPSIGNATARIO CHAR(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE CRM_INTERLOCUTOR ADD CONSTRAINT CK_IDTPSIGNATARIO CHECK(IDTPSIGNATARIO IN ('N', 'T', 'S'))
/