ALTER TABLE FCT_CONTRATO ADD TPESTRUTINTEGRAHCM VARCHAR2(1)
/
ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CKC_TPESTRUTINTEGRAHCM_CONT CHECK (TPESTRUTINTEGRAHCM IN ('T','P'))
/
UPDATE FCT_CONTRATO
   SET TPESTRUTINTEGRAHCM = 'T'
 WHERE TPESTRUTINTEGRAHCM IS NULL 
/
COMMIT
/
 

ALTER TABLE FCT_CONTRATO ADD IDINTEGRAESCALAHCM VARCHAR2(1)
/
ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CKC_IDINTEGRAESCALAHCM_CONT CHECK (IDINTEGRAESCALAHCM IN ('S','N'))
/
UPDATE FCT_CONTRATO
   SET IDINTEGRAESCALAHCM = 'N'
 WHERE IDINTEGRAESCALAHCM IS NULL 
/
COMMIT
/
 
ALTER TABLE FCT_CONTRATO ADD IDAGRUPAESCALAHCM VARCHAR2(1)
/
ALTER TABLE FCT_CONTRATO ADD CONSTRAINT CKC_IDAGRUPAESCALAHCM CHECK (IDAGRUPAESCALAHCM IN ('S','N'))
/
UPDATE FCT_CONTRATO
   SET IDAGRUPAESCALAHCM = 'N'
 WHERE IDAGRUPAESCALAHCM IS NULL 
/
COMMIT
/

ALTER TABLE FCT_ITEMCONTRATO ADD NRESCALATRABALHOHCM NUMBER
/
ALTER TABLE FCT_ITEMCONTRATO ADD NMESCALATRABALHOHCM VARCHAR2(250)
/


ALTER TABLE FCT_NEGOCIACAOCONTRATO ADD NRESCALATRABALHOHCM NUMBER
/



CREATE TABLE FCT_ESCALATRABHCM_TMP (
	NRESCALATRABM     NUMBER,
	NMESCALATRABH     VARCHAR2(250),
	NRNMESCALATRABM   VARCHAR2 (250),
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        DATE            DEFAULT SYSDATE,
    DTULTATU          DATE            DEFAULT SYSDATE,
    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',
		CONSTRAINT CKC_IDATIVO_FCT_ESCLTRBHCM_TMP CHECK (IDATIVO IN ('S','N'))
)
/