ALTER TABLE FCT_TABPRECESCOPOFAT DROP CONSTRAINT FKSM00389TIPORCATRABPRECESCFAT
/
ALTER TABLE FCT_TABPRECESCOPOFAT ADD CONSTRAINT FKSM00389TIPORCATRABPRECESCFAT
    FOREIGN KEY (NRTIPOORCAMENTO) REFERENCES FCT_TIPOORCAMENTO (NRTIPOORCAMENTO) ON DELETE CASCADE
/
ALTER TABLE FCT_ORCAMENTO ADD CDIDIOM VARCHAR2(10)
/
ALTER TABLE FCT_ORCAMENTO ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_ORCAMENTO ADD CONSTRAINT FKSM00398ORCAMENTO_IDIOMA
    FOREIGN KEY (CDIDIOM) REFERENCES IDIOMA (CDIDIOM)
/
CREATE INDEX SM00398_FK ON FCT_ORCAMENTO (CDIDIOM ASC)
/
ALTER TABLE FCT_ORCAMENTO ADD CONSTRAINT FKSM00399ORCAMENTO_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00399_FK ON FCT_ORCAMENTO (NRMOEDA ASC)
/
ALTER TABLE FCT_ITEMORCAMENTO ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_ITEMORCAMENTO ADD CONSTRAINT FKSM00400ITEMORCAMENTO_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00400_FK ON FCT_ITEMORCAMENTO (NRMOEDA ASC)
/
CREATE TABLE FCT_ORCAMENTODOCIDIOMA (
    NRORCAMENTODOCIDIOMA NUMBER 		 NOT NULL,
    NRSEQORCADOC         NUMBER 		 NOT NULL,
    CDIDIOM              VARCHAR2(10),
    NMARQUIVO            VARCHAR2(300),
    DSCAMINHOARQ         VARCHAR2(500),
    DSTIPO               VARCHAR2(150),
    VRTAMANHO            FLOAT(126),
    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'
)
/
ALTER TABLE FCT_ORCAMENTODOCIDIOMA ADD CONSTRAINT PK_FCT_ORCAMENTODOCIDIOMA PRIMARY KEY (NRORCAMENTODOCIDIOMA)
/
ALTER TABLE FCT_ORCAMENTODOCIDIOMA ADD CONSTRAINT CKC_IDATIVO_ORCADOCIDIOMA CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE FCT_ORCAMENTODOCIDIOMA ADD CONSTRAINT FKSM00401ORCADOCIDIOMA_ORCADOC
    FOREIGN KEY (NRSEQORCADOC) REFERENCES FCT_ORCAMENTODOC (NRSEQORCADOC) ON DELETE CASCADE
/
CREATE INDEX SM00401_FK ON FCT_ORCAMENTODOCIDIOMA (NRSEQORCADOC ASC)
/
ALTER TABLE FCT_ORCAMENTODOCIDIOMA ADD CONSTRAINT FKSM00402ORCADOCIDIOMA_IDIOMA
    FOREIGN KEY (CDIDIOM) REFERENCES IDIOMA (CDIDIOM)
/
CREATE INDEX SM00402_FK ON FCT_ORCAMENTODOCIDIOMA (CDIDIOM ASC)
/
ALTER TABLE FCT_CONTRATO ADD CDIDIOM VARCHAR2(10)
/
ALTER TABLE FCT_CONTRATO ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_CONTRATO ADD CONSTRAINT FKSM00403CONTRATO_IDIOMA
    FOREIGN KEY (CDIDIOM) REFERENCES IDIOMA (CDIDIOM)
/
CREATE INDEX SM00403_FK ON FCT_CONTRATO (CDIDIOM ASC)
/
ALTER TABLE FCT_CONTRATO ADD CONSTRAINT FKSM00404CONTRATO_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00404_FK ON FCT_CONTRATO (NRMOEDA ASC)
/
ALTER TABLE FCT_ITEMCONTRATO ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_ITEMCONTRATO ADD CONSTRAINT FKSM00405ITEMCONTRATO_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00405_FK ON FCT_ITEMCONTRATO (NRMOEDA ASC)
/
CREATE TABLE FCT_ORCAMENTODOCSITU (
    NRORCAMENTODOCSITU   NUMBER,
    NRSEQORCADOC         NUMBER,
    IDSITUACAOORCAMENTO  VARCHAR2(30),
    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'
)
/
ALTER TABLE FCT_ORCAMENTODOCSITU ADD CONSTRAINT PK_FCT_ORCAMENTODOCSITU PRIMARY KEY (NRORCAMENTODOCSITU)
/
ALTER TABLE FCT_ORCAMENTODOCSITU ADD CONSTRAINT CKC_IDATIVO_ORCAMENTODOCSITU CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE FCT_ORCAMENTODOCSITU ADD CONSTRAINT FKSM00406ORCMENTDCSITU_ORCADOC
    FOREIGN KEY (NRSEQORCADOC) REFERENCES FCT_ORCAMENTODOC (NRSEQORCADOC) ON DELETE CASCADE
/
CREATE INDEX SM00406_FK ON FCT_ORCAMENTODOCSITU (NRSEQORCADOC ASC)
/
ALTER TABLE FCT_MEDICAOFATURA ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_MEDICAOFATURA ADD CONSTRAINT FKSM00407MEDICAOFATURA_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00407_FK ON FCT_MEDICAOFATURA (NRMOEDA ASC)
/
ALTER TABLE FCT_FATURACONT ADD NRMOEDA NUMBER
/
ALTER TABLE FCT_FATURACONT ADD CONSTRAINT FKSM00408FATURACONT_MOEDA
    FOREIGN KEY (NRMOEDA) REFERENCES FCT_MOEDA (NRMOEDA)
/
CREATE INDEX SM00408_FK ON FCT_FATURACONT (NRMOEDA)