alter table TCUENTACONTABLEHOMOLOGADA drop constraint FKCUECONHOMCODCON; alter table TCUENTACONTABLEHOMOLOGADA drop constraint FKCUECONHOMSUB; alter table TCUENTACONTABLEHOMOLOGADA drop constraint FKCUECONHOMUSUING; alter table TCUENTACONTABLEHOMOLOGADA drop constraint FKCUECONHOMUSUMOD; alter table TCUENTACONTABLEHOMOLOGADA drop primary key cascade; drop table TCUENTACONTABLEHOMOLOGADA cascade constraints; /*==============================================================*/ /* Table: TCUENTACONTABLEHOMOLOGADA */ /*==============================================================*/ create table TCUENTACONTABLEHOMOLOGADA ( CPERSONA_COMPANIA NUMBER(8) not null, CSUBSISTEMA_EXTERNO VARCHAR2(2) not null, CODIGOCONTABLE_EXTERNO VARCHAR2(20) not null, FHASTA TIMESTAMP not null, CODIGOCONTABLE VARCHAR2(20) not null, VERSIONCONTROL NUMBER(22) default 0, FDESDE TIMESTAMP not null, CUSUARIO_INGRESO VARCHAR2(12), CUSUARIO_MODIFICACION VARCHAR2(12) ); comment on table TCUENTACONTABLEHOMOLOGADA is 'Homologacion de cuentas contables del fitbank con los subsistemas externos'; comment on column TCUENTACONTABLEHOMOLOGADA.CPERSONA_COMPANIA is 'Codigo de la compania'; comment on column TCUENTACONTABLEHOMOLOGADA.CODIGOCONTABLE is 'Codigo contable del Fitbank'; comment on column TCUENTACONTABLEHOMOLOGADA.CSUBSISTEMA_EXTERNO is 'Codigo del subsistema externo homologado'; comment on column TCUENTACONTABLEHOMOLOGADA.CODIGOCONTABLE_EXTERNO is 'Codigo contable que corresponde al subsistema externo homologado'; comment on column TCUENTACONTABLEHOMOLOGADA.FHASTA is 'Fecha hasta la que esta vigente la homologacion del codigo contable'; comment on column TCUENTACONTABLEHOMOLOGADA.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TCUENTACONTABLEHOMOLOGADA.FDESDE is 'Fecha desde la que esta vigente la homologacion del codigo contable'; alter table TCUENTACONTABLEHOMOLOGADA add constraint IPKCUECONHOM primary key (CPERSONA_COMPANIA,CSUBSISTEMA_EXTERNO,CODIGOCONTABLE_EXTERNO,FHASTA); alter table TCUENTACONTABLEHOMOLOGADA add constraint FKCUECONHOMCODCON foreign key (CPERSONA_COMPANIA,CODIGOCONTABLE) references TCUENTACONTABLEID (CPERSONA_COMPANIA,CODIGOCONTABLE); alter table TCUENTACONTABLEHOMOLOGADA add constraint FKCUECONHOMSUB foreign key (CSUBSISTEMA_EXTERNO) references TSUBSISTEMAID (CSUBSISTEMA); alter table TCUENTACONTABLEHOMOLOGADA add constraint FKCUECONHOMUSUING foreign key (CUSUARIO_INGRESO) references TUSUARIOSID (CUSUARIO); alter table TCUENTACONTABLEHOMOLOGADA add constraint FKCUECONHOMUSUMOD foreign key (CUSUARIO_MODIFICACION) references TUSUARIOSID (CUSUARIO); -------------------------------- ----ALTER TABLA TDESTINOCREDITOID ------------------------------- alter table TDESTINOCREDITOID drop constraint FKDESCRETIPPRE; alter table TDESTINOCREDITOID add CTIPOPRESTAMO VARCHAR2(2); comment on column TDESTINOCREDITOID.CTIPOPRESTAMO is 'Codigo del Tipo de Prestamo'; alter table TDESTINOCREDITOID add constraint FKDESCRETIPPRE foreign key (CTIPOPRESTAMO) references TTIPOSPRESTAMOID (CTIPOPRESTAMO); update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='1'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='2'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='3'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='4'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='5'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='6'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='7'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='8'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='21'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='22'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='23'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='24'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='25'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='26'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='27'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='28'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='29'; update tdestinocreditoid set ctipoprestamo='3' where cdestinocredito='30'; update tdestinocreditoid set ctipoprestamo='2' where cdestinocredito='OT'; -------------------------------- ----ALTER TABLA TSOLICITUDCOMERCIOEXTERIOR ------------------------------- alter table TSOLICITUDCOMERCIOEXTERIOR drop constraint FKSOLCOMEXTDES; alter table TSOLICITUDCOMERCIOEXTERIOR drop constraint FKSOLCOMEXTACT; alter table TSOLICITUDCOMERCIOEXTERIOR drop constraint FKSOLCOMEXTPAR; alter table TSOLICITUDCOMERCIOEXTERIOR add (CDESTINOFONDOS VARCHAR2(4), CDESTINOCREDITO VARCHAR2(3), CODIGOACTIVIDAD VARCHAR2(10), CPAIS_INVERSION VARCHAR2(3), CPROVINCIA_INVERSION VARCHAR2(3), CCANTON_INVERSION VARCHAR2(6), CPARROQUIA_INVERSION VARCHAR2(6)); comment on column TSOLICITUDCOMERCIOEXTERIOR.CDESTINOFONDOS is 'Codigo de Destino Fondos'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CDESTINOCREDITO is 'Codigo de Destino de Credito'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CODIGOACTIVIDAD is 'Codigo de la actividad'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CPAIS_INVERSION is 'Codigo Pais de Inversion'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CPROVINCIA_INVERSION is 'Codigo Provincia de Inversion'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CCANTON_INVERSION is 'Codigo Canton de Inversion'; comment on column TSOLICITUDCOMERCIOEXTERIOR.CPARROQUIA_INVERSION is 'Codigo Parroquia de Inversion'; alter table TSOLICITUDCOMERCIOEXTERIOR add constraint FKSOLCOMEXTDES foreign key (CDESTINOFONDOS,CDESTINOCREDITO) references TDESTINOCREDITOID (CDESTINOFONDOS,CDESTINOCREDITO); alter table TSOLICITUDCOMERCIOEXTERIOR add constraint FKSOLCOMEXTACT foreign key (CODIGOACTIVIDAD) references TCODIGOSACTIVIDADID (CODIGOACTIVIDAD); alter table TSOLICITUDCOMERCIOEXTERIOR add constraint FKSOLCOMEXTPAR foreign key (CPARROQUIA_INVERSION,CPAIS_INVERSION,CPROVINCIA_INVERSION,CCANTON_INVERSION) references TPARROQUIASID (CPARROQUIA,CPAIS,CPROVINCIA,CCANTON); -------------------------------- ----ALTER TABLA TCUENTACOMERCIOEXTERIOR ------------------------------- alter table TCUENTACOMERCIOEXTERIOR drop constraint FKCUECOMEXTDES; alter table TCUENTACOMERCIOEXTERIOR drop constraint FKCUECOMEXTACT; alter table TCUENTACOMERCIOEXTERIOR drop constraint FKCUECOMEXTPAR; alter table TCUENTACOMERCIOEXTERIOR add (CDESTINOFONDOS VARCHAR2(4), CDESTINOCREDITO VARCHAR2(3), CODIGOACTIVIDAD VARCHAR2(10), CPAIS_INVERSION VARCHAR2(3), CPROVINCIA_INVERSION VARCHAR2(3), CCANTON_INVERSION VARCHAR2(6), CPARROQUIA_INVERSION VARCHAR2(6)); comment on column TCUENTACOMERCIOEXTERIOR.CDESTINOFONDOS is 'Codigo de Destino Fondos'; comment on column TCUENTACOMERCIOEXTERIOR.CDESTINOCREDITO is 'Codigo de Destino de Credito'; comment on column TCUENTACOMERCIOEXTERIOR.CODIGOACTIVIDAD is 'Codigo de la actividad'; comment on column TCUENTACOMERCIOEXTERIOR.CPAIS_INVERSION is 'Codigo Pais de Inversion'; comment on column TCUENTACOMERCIOEXTERIOR.CPROVINCIA_INVERSION is 'Codigo Provincia de Inversion'; comment on column TCUENTACOMERCIOEXTERIOR.CCANTON_INVERSION is 'Codigo Canton de Inversion'; comment on column TCUENTACOMERCIOEXTERIOR.CPARROQUIA_INVERSION is 'Codigo Parroquia de Inversion'; alter table TCUENTACOMERCIOEXTERIOR add constraint FKCUECOMEXTDES foreign key (CDESTINOFONDOS,CDESTINOCREDITO) references TDESTINOCREDITOID (CDESTINOFONDOS,CDESTINOCREDITO); alter table TCUENTACOMERCIOEXTERIOR add constraint FKCUECOMEXTACT foreign key (CODIGOACTIVIDAD) references TCODIGOSACTIVIDADID (CODIGOACTIVIDAD); alter table TCUENTACOMERCIOEXTERIOR add constraint FKCUECOMEXTPAR foreign key (CPARROQUIA_INVERSION,CPAIS_INVERSION,CPROVINCIA_INVERSION,CCANTON_INVERSION) references TPARROQUIASID (CPARROQUIA,CPAIS,CPROVINCIA,CCANTON); /*==============================================================*/ /* Table: TPERSONASENBASENEGATIVA */ /*==============================================================*/ alter table TPERSONASENBASENEGATIVA drop constraint IPKPERBASNEG cascade; alter table TPERSONASENBASENEGATIVA add constraint IPKPERBASNEG primary key (FPROCESO,IDENTIFICACION,FHASTA,CFUENTEINFORMACION); -----------------TABLAS CONTABILIDAD alter table TCODIGOSPLANTILLAREPORTESID drop primary key cascade; drop table TCODIGOSPLANTILLAREPORTESID cascade constraints; /*==============================================================*/ /* Table: TCODIGOSPLANTILLAREPORTESID */ /*==============================================================*/ create table TCODIGOSPLANTILLAREPORTESID ( CPERSONA_COMPANIA NUMBER (8) not null, CPLANTILLAREPORTE NUMBER (4) not null, CTIPOPLANTILLAREPORTE NUMBER(2), AUTOMATICO VARCHAR2(1) default '0', ORDEN NUMBER (8) ); comment on table TCODIGOSPLANTILLAREPORTESID is 'Codigos de las plantillas de los estados financieros de la contabilidad'; comment on column TCODIGOSPLANTILLAREPORTESID.CPERSONA_COMPANIA is 'Codigo de persona de la compania'; comment on column TCODIGOSPLANTILLAREPORTESID.CPLANTILLAREPORTE is 'Codigo de plantilla de los reportes de contabilidad'; comment on column TCODIGOSPLANTILLAREPORTESID.CTIPOPLANTILLAREPORTE is 'Codigo del tipo de plantilla del reporte'; comment on column TCODIGOSPLANTILLAREPORTESID.AUTOMATICO is 'Indica si el Reporte se genera de manera automatica'; comment on column TCODIGOSPLANTILLAREPORTESID.ORDEN is 'Orden de presentacion del reporte'; alter table TCODIGOSPLANTILLAREPORTESID add constraint CKAUTOMATICOTCP check (AUTOMATICO is null or (AUTOMATICO = upper(AUTOMATICO) and AUTOMATICO in ('1','0'))); alter table TCODIGOSPLANTILLAREPORTESID add constraint IPKCODPLANREPID primary key (CPERSONA_COMPANIA, CPLANTILLAREPORTE); alter table TCODIGOSPLANTILLAREPORTES drop primary key cascade; drop table TCODIGOSPLANTILLAREPORTES cascade constraints; /*==============================================================*/ /* Table: TCODIGOSPLANTILLAREPORTES */ /*==============================================================*/ create table TCODIGOSPLANTILLAREPORTES ( CPERSONA_COMPANIA NUMBER (8) not null, CPLANTILLAREPORTE NUMBER (4) not null, FHASTA TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, FDESDE TIMESTAMP not null, FINICIO DATE not null, FFINALIZA DATE not null, OBSERVACIONES VARCHAR2(100), COPIAR VARCHAR2(1), CPLANTILLAREPORTE_BASE NUMBER(4), REFERENCIA NUMBER(19,6) ); comment on table TCODIGOSPLANTILLAREPORTES is 'Definicion de la plantilla de reporte para su emision y observaciones'; comment on column TCODIGOSPLANTILLAREPORTES.CPERSONA_COMPANIA is 'Codigo de persona de la compania'; comment on column TCODIGOSPLANTILLAREPORTES.CPLANTILLAREPORTE is 'Codigo de plantilla de los reportes de contabilidad'; comment on column TCODIGOSPLANTILLAREPORTES.FHASTA is 'Fecha de vigencia del registro'; comment on column TCODIGOSPLANTILLAREPORTES.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TCODIGOSPLANTILLAREPORTES.FDESDE is 'Fecha de creacion del registro'; comment on column TCODIGOSPLANTILLAREPORTES.FINICIO is 'Fecha en que inicia el reporte'; comment on column TCODIGOSPLANTILLAREPORTES.FFINALIZA is 'Fecha en que finaliza el reporte'; comment on column TCODIGOSPLANTILLAREPORTES.OBSERVACIONES is 'Observaciones del reporte'; comment on column TCODIGOSPLANTILLAREPORTES.COPIAR is 'Marca si se genera la plantilla en funcion de otra'; comment on column TCODIGOSPLANTILLAREPORTES.CPLANTILLAREPORTE_BASE is 'Codigo de plantilla del reporte base'; comment on column TCODIGOSPLANTILLAREPORTES.REFERENCIA is 'Valor de referencia del reporte'; alter table TCODIGOSPLANTILLAREPORTES add constraint IPKCODPLANREP primary key (CPERSONA_COMPANIA, CPLANTILLAREPORTE, FHASTA); alter table TCODIGOSPLANTILLAREPORTES add constraint FKCODPLANTREPBASE foreign key (CPERSONA_COMPANIA, CPLANTILLAREPORTE_BASE) references TCODIGOSPLANTILLAREPORTESID (CPERSONA_COMPANIA, CPLANTILLAREPORTE); alter table TCODIGOSPLANTILLAREPORTES add constraint FKCODPLANTREPID foreign key (CPERSONA_COMPANIA, CPLANTILLAREPORTE) references TCODIGOSPLANTILLAREPORTESID (CPERSONA_COMPANIA, CPLANTILLAREPORTE); alter table TPLANTILLAINDICESID drop constraint FKCODPLANTIPPLAN; alter table TPLANTILLAINDICESID drop primary key cascade; drop table TPLANTILLAINDICESID cascade constraints; /*==============================================================*/ /* Table: TPLANTILLAINDICESID */ /*==============================================================*/ create table TPLANTILLAINDICESID ( CPERSONA_COMPANIA NUMBER (8) not null, CPLANTILLAREPORTE NUMBER (4) not null, ORDEN NUMBER(2) not null, CTIPOPLANTILLAREPORTE VARCHAR2(6) ); comment on table TPLANTILLAINDICESID is 'Id de la definicion de las plantillas para el reporte contable que requieren definicion de formulas como los indices'; comment on column TPLANTILLAINDICESID.CPERSONA_COMPANIA is 'Codigo de persona de la compania'; comment on column TPLANTILLAINDICESID.CPLANTILLAREPORTE is 'Codigo de plantilla de los reportes de contabilidad'; comment on column TPLANTILLAINDICESID.ORDEN is 'Orden de la linea en el reporte'; comment on column TPLANTILLAINDICESID.CTIPOPLANTILLAREPORTE is 'Codigo del tipo de plantilla del reporte'; alter table TPLANTILLAINDICESID add constraint IPKPLANTINDID primary key (CPERSONA_COMPANIA, CPLANTILLAREPORTE, ORDEN); alter table TPLANTILLAINDICESID add constraint FKCODPLANTIPPLAN foreign key (CTIPOPLANTILLAREPORTE) references TTIPOSPLANTILLAREPORTESID (CTIPOPLANTILLAREPORTE); alter table TPLANTILLAINDICESID add constraint FKCODPLANTREPIND foreign key (CPERSONA_COMPANIA, CPLANTILLAREPORTE) references TCODIGOSPLANTILLAREPORTESID (CPERSONA_COMPANIA, CPLANTILLAREPORTE); /*==============================================================*/ /* Table: TPLANTILLAINDICES */ /*==============================================================*/ alter table TPLANTILLAINDICES drop constraint FKCODPLANTREPINDID; alter table TPLANTILLAINDICES add constraint FKCODPLANTREPINDID foreign key (CPERSONA_COMPANIA, CPLANTILLAREPORTE, ORDEN) references TPLANTILLAINDICESID (CPERSONA_COMPANIA, CPLANTILLAREPORTE, ORDEN); /*==============================================================*/ /* Table: TPLANTILLAINDICESDETALLE */ /*==============================================================*/ alter table TPLANTILLAINDICESDETALLE drop constraint FKCODPLANTREPINDDET; alter table TPLANTILLAINDICESDETALLE add constraint FKCODPLANTREPINDDET foreign key (CPERSONA_COMPANIA, CPLANTILLAREPORTE, ORDEN) references TPLANTILLAINDICESID (CPERSONA_COMPANIA, CPLANTILLAREPORTE, ORDEN); /*==============================================================*/ /* Table: TREPORTEINDICES */ /*==============================================================*/ alter table TREPORTEINDICES drop constraint FKREPINDTER; alter table TREPORTEINDICES drop constraint FKREPINDUSU; alter table TREPORTEINDICES drop constraint FKREPINDPLAN; alter table TREPORTEINDICES add constraint FKREPINDPLAN foreign key (CPERSONA_COMPANIA,CPLANTILLAREPORTE,ORDEN) references TPLANTILLAINDICESID (CPERSONA_COMPANIA,CPLANTILLAREPORTE,ORDEN); alter table TREPORTEINDICES add constraint FKREPINDTER foreign key (CTERMINAL) references TTERMINALESID (CTERMINAL); alter table TREPORTEINDICES add constraint FKREPINDUSU foreign key (CUSUARIO) references TUSUARIOSID (CUSUARIO); -------------- /*==============================================================*/ /* Table: TCODIGOSPLANTILLAREPORTES */ /*==============================================================*/ alter table TCODIGOSPLANTILLAREPORTES modify ( FINICIO null ); alter table TCODIGOSPLANTILLAREPORTES modify ( FFINALIZA null ); alter table TCODIGOSPLANTILLAREPORTES modify ( OBSERVACIONES not null ); /*==============================================================*/ /* Table: TCODIGOSPLANTILLAREPORTESID */ /*==============================================================*/ alter table TCODIGOSPLANTILLAREPORTESID drop column CTIPOPLANTILLAREPORTE; alter table TCODIGOSPLANTILLAREPORTESID add CTIPOPLANTILLAREPORTE VARCHAR2(6); comment on column TCODIGOSPLANTILLAREPORTESID.CTIPOPLANTILLAREPORTE is 'Tipo de la Plantilla de Reporte'; alter table TCODIGOSPLANTILLAREPORTESID add constraint FKCODPLANTREPTIPPLA foreign key (CTIPOPLANTILLAREPORTE) references TTIPOSPLANTILLAREPORTESID (CTIPOPLANTILLAREPORTE); -------------------------------------------------------------------------- /*==============================================================*/ /* Table: TCODIGOSPLANTILLAREPORTES */ /*==============================================================*/ alter table TCODIGOSPLANTILLAREPORTES add NUMEROFORMULARIO VARCHAR2(20); comment on column TCODIGOSPLANTILLAREPORTES.NUMEROFORMULARIO is 'Formulario SRI con el que se relaciona la plantilla del reporte'; insert into TLOGACTUALIZACIONES (FENTREGA,ACTUALIZACIONESQUEMA,INCIDENCIA,FACTUALIZACION) values ( to_timestamp('2017-07-18 13:00:00.415421','yyyy-mm-dd hh24:mi:ss.ff'),'fitbank201067115-4', null, Systimestamp);