/*==============================================================*/ /* Database name: Database */ /* DBMS name: ORACLE Version 10g */ /* Created on: 13/01/2010 15:24:15 PM */ /*==============================================================*/ -- SQL script that update fitBank squema -- To run this script from the SQL Plus, perform the following steps: -- 1. connect to the database -- 2. set define character to ! -- "set define !" -- 3. issue the command "@ " -- where represents the name of this script spool fitbank201063008.log alter table TCUENTAINVERSIONES drop constraint FKCTAINVTIPMERC; alter table TTIPOSMERCADO drop constraint FKTIPMERCID; alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALTIPMERC; alter table TTIPOSMERCADOID drop primary key cascade; drop table TTIPOSMERCADOID cascade constraints; /*==============================================================*/ /* Table: TTIPOSMERCADOID */ /*==============================================================*/ create table TTIPOSMERCADOID ( CTIPOMERCADO VARCHAR2(3) not null ); comment on table TTIPOSMERCADOID is 'Codigos de los tipos de mercado de inversiones'; comment on column TTIPOSMERCADOID.CTIPOMERCADO is 'Codigo de tipo de mercado de inversiones'; alter table TTIPOSMERCADOID add constraint IPKTIPMERCID primary key (CTIPOMERCADO); alter table TTIPOSMERCADO drop constraint FKIDITIPMERC; alter table TTIPOSMERCADO drop constraint FKTIPMERCID; alter table TTIPOSMERCADO drop primary key cascade; drop table TTIPOSMERCADO cascade constraints; /*==============================================================*/ /* Table: TTIPOSMERCADO */ /*==============================================================*/ create table TTIPOSMERCADO ( CIDIOMA VARCHAR2(3) not null, CTIPOMERCADO VARCHAR2(3) not null, FHASTA TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, FDESDE TIMESTAMP not null, DESCRIPCION VARCHAR2(30) not null ); comment on table TTIPOSMERCADO is 'Descripcion por idioma de los codigos de los tipos de mercado de inversiones'; comment on column TTIPOSMERCADO.CIDIOMA is 'Codigo del idioma'; comment on column TTIPOSMERCADO.CTIPOMERCADO is 'Codigo de tipo de mercado de inversiones'; comment on column TTIPOSMERCADO.FHASTA is 'Fecha hasta la que esta vigente la descripcion del tipo de mercado'; comment on column TTIPOSMERCADO.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TTIPOSMERCADO.FDESDE is 'Fecha desde la que esta vigente la descripcion del tipo de mercado'; comment on column TTIPOSMERCADO.DESCRIPCION is 'Descripcion del tipo de mercado'; alter table TTIPOSMERCADO add constraint IPKTIPMERC primary key (CIDIOMA, CTIPOMERCADO, FHASTA); alter table TTIPOSMERCADO add constraint FKIDITIPMERC foreign key (CIDIOMA) references TIDIOMASID (CIDIOMA); alter table TTIPOSMERCADO add constraint FKTIPMERCID foreign key (CTIPOMERCADO) references TTIPOSMERCADOID (CTIPOMERCADO); alter table TCUENTAINVERSIONES drop constraint FKCTAINV; alter table TCUENTAINVERSIONES drop constraint FKCTAINVBASCALC; alter table TCUENTAINVERSIONES drop constraint FKCTAINVFREQCUP; alter table TCUENTAINVERSIONES drop constraint FKCTAINVFREQREV; alter table TCUENTAINVERSIONES drop constraint FKCTAINVTIPINS; alter table TCUENTAINVERSIONES drop constraint FKCTAINVTIPMERC; alter table TCUENTAINVERSIONES drop constraint FKCTAINVTIPPOR; alter table TCUENTAINVERSIONES drop primary key cascade; drop table TCUENTAINVERSIONES cascade constraints; /*==============================================================*/ /* Table: TCUENTAINVERSIONES */ /*==============================================================*/ create table TCUENTAINVERSIONES ( CCUENTA VARCHAR2(19) not null, CPERSONA_COMPANIA NUMBER(8) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, CTIPOPORTAFOLIO VARCHAR2(3), CTIPOTITULOVALOR VARCHAR2(3) not null, CTIPOINSTRUMENTO NUMBER(2) not null, VALORMERCADO NUMBER(19,6) not null, VALORNOMINAL NUMBER(19,6) not null, VALORPRIMA NUMBER(19,6), VALORDESCUENTO NUMBER(19,6), TASA NUMBER(10,6), PLAZO NUMBER(5), FVENCIMIENTO DATE not null, CLASIFICACIONFASB115 VARCHAR2(15), VERSIONCONTROL NUMBER(22) default 0, RENTAFIJAVARIABLE VARCHAR2(1), FEMISION DATE, INTERES NUMBER(19,6), TASAEFECTIVA NUMBER(10,6), TASABASE NUMBER(10,6), CFRECUENCIA_REVISION NUMBER(2), CBASECALCULO VARCHAR2(14), PORCENTAJEPRECIO NUMBER(10,6), PORCENTAJERENDIMIENTO NUMBER(10,6), TIENECUPON VARCHAR2(1) default '0', CFRECUENCIA_CUPONES NUMBER(2), CTIPOMERCADO VARCHAR2(3), NUMEROCUPONES NUMBER(3), PLAZOREMANENTE NUMBER(5), DIASACCRUAL NUMBER(5), INTERESACUMULADO NUMBER(19,6), FVALUACION DATE, PORCENTAJEPRECIOVALUACION NUMBER(10,6) ); comment on table TCUENTAINVERSIONES is 'Cuentas de inversiones de titulos valor'; comment on column TCUENTAINVERSIONES.CCUENTA is 'Numero de cuenta de inversiones'; comment on column TCUENTAINVERSIONES.CPERSONA_COMPANIA is 'Codigo de la compania'; comment on column TCUENTAINVERSIONES.FHASTA is 'Fecha hasta la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TCUENTAINVERSIONES.FDESDE is 'Fecha desde la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TCUENTAINVERSIONES.CTIPOPORTAFOLIO is 'Codigo del tipo de portafolio de la cuenta de inversion (Propio, De terceros)'; comment on column TCUENTAINVERSIONES.CTIPOTITULOVALOR is 'Codigo del tipo de titulo valor de la cuenta de inversion'; comment on column TCUENTAINVERSIONES.CTIPOINSTRUMENTO is 'Codigo del tipo de instrumento de inversiones'; comment on column TCUENTAINVERSIONES.VALORMERCADO is 'Monto del mercado del documento de de una cuenta de inversiones'; comment on column TCUENTAINVERSIONES.VALORNOMINAL is 'Monto nominal del documento de una cuenta de inversiones'; comment on column TCUENTAINVERSIONES.VALORPRIMA is 'Valor de la prima en la negociacion de la inversion'; comment on column TCUENTAINVERSIONES.VALORDESCUENTO is 'Valor del descuento en la negociacion de la inversion'; comment on column TCUENTAINVERSIONES.TASA is 'Tasa original de la cuenta ed inversiones'; comment on column TCUENTAINVERSIONES.PLAZO is 'Plazo original de la cuenta de inversiones'; comment on column TCUENTAINVERSIONES.FVENCIMIENTO is 'Fecha de vencimiento de la cuenta de inversiones'; comment on column TCUENTAINVERSIONES.CLASIFICACIONFASB115 is 'Clasificacion FASB115 del instrumento de la inversion'; comment on column TCUENTAINVERSIONES.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TCUENTAINVERSIONES.RENTAFIJAVARIABLE is 'Indica si el instrumento de la inversion es de renta F=fija o V=variable'; comment on column TCUENTAINVERSIONES.FEMISION is 'Fecha referencial de emision del titulo valor'; comment on column TCUENTAINVERSIONES.INTERES is 'Valor proyectado del interes al vencimiento de la inversion'; comment on column TCUENTAINVERSIONES.TASAEFECTIVA is 'Tasa efectiva calculado de acuerdo a la tasa nominal de la inversion'; comment on column TCUENTAINVERSIONES.TASABASE is 'Tasa base referencial de la inversion'; comment on column TCUENTAINVERSIONES.CFRECUENCIA_REVISION is 'Codigo de frecuencia de revision del diferencial de la inversion'; comment on column TCUENTAINVERSIONES.CBASECALCULO is 'Base de calculo que se aplica a la inversion'; comment on column TCUENTAINVERSIONES.PORCENTAJEPRECIO is 'Porcentaje de precio aplicado en la negociacion'; comment on column TCUENTAINVERSIONES.PORCENTAJERENDIMIENTO is 'Porcentaje de rendimiento aplicado en la negociacion'; comment on column TCUENTAINVERSIONES.TIENECUPON is 'Indica si la operacion de inversiones tiene cupon o no'; comment on column TCUENTAINVERSIONES.CFRECUENCIA_CUPONES is 'Codigo de frecuencia de los cupones de la inversion'; comment on column TCUENTAINVERSIONES.CTIPOMERCADO is 'Codigo de tipo de mercado de inversiones'; comment on column TCUENTAINVERSIONES.NUMEROCUPONES is 'Numero de cupones de la inversion'; comment on column TCUENTAINVERSIONES.PLAZOREMANENTE is 'Plazo remanente al momento de la negociacion'; comment on column TCUENTAINVERSIONES.DIASACCRUAL is 'Plazo en dias del accrual al momento de la negociacion'; comment on column TCUENTAINVERSIONES.INTERESACUMULADO is 'Interes acumulado al momento de la negociadion'; comment on column TCUENTAINVERSIONES.FVALUACION is 'Fecha de valuacion de la inversion'; comment on column TCUENTAINVERSIONES.PORCENTAJEPRECIOVALUACION is 'Precio de valuacion de la inversion a la fecha'; alter table TCUENTAINVERSIONES add constraint CKRENTAFIJAVARIABLECI check (RENTAFIJAVARIABLE is null or (RENTAFIJAVARIABLE = upper(RENTAFIJAVARIABLE) and RENTAFIJAVARIABLE in ('F','V'))); alter table TCUENTAINVERSIONES add constraint CKTIENECUPONCI check (TIENECUPON is null or (TIENECUPON = upper(TIENECUPON) and TIENECUPON in ('1','0'))); alter table TCUENTAINVERSIONES add constraint IPKCTAINV primary key (CPERSONA_COMPANIA, CCUENTA, FHASTA); alter table TCUENTAINVERSIONES add constraint FKCTAINV foreign key (CCUENTA, CPERSONA_COMPANIA) references TCUENTAID (CCUENTA, CPERSONA_COMPANIA); alter table TCUENTAINVERSIONES add constraint FKCTAINVBASCALC foreign key (CBASECALCULO) references TBASESCALCULOID (CBASECALCULO); alter table TCUENTAINVERSIONES add constraint FKCTAINVFREQCUP foreign key (CFRECUENCIA_CUPONES) references TFRECUENCIASID (CFRECUENCIA); alter table TCUENTAINVERSIONES add constraint FKCTAINVFREQREV foreign key (CFRECUENCIA_REVISION) references TFRECUENCIASID (CFRECUENCIA); alter table TCUENTAINVERSIONES add constraint FKCTAINVTIPINS foreign key (CTIPOTITULOVALOR, CTIPOINSTRUMENTO) references TTIPOSINSTRUMENTOID (CTIPOTITULOVALOR, CTIPOINSTRUMENTO); alter table TCUENTAINVERSIONES add constraint FKCTAINVTIPMERC foreign key (CTIPOMERCADO) references TTIPOSMERCADOID (CTIPOMERCADO); alter table TCUENTAINVERSIONES add constraint FKCTAINVTIPPOR foreign key (CTIPOPORTAFOLIO) references TTIPOSPORTAFOLIOID (CTIPOPORTAFOLIO); alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALBASCALC; alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALFREQREV; alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALTIPINST; alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALTIPMERC; alter table TTITULOSVALORCARACTERISTICAS drop constraint FKTITVALTIPPORT; alter table TTITULOSVALORCARACTERISTICAS drop primary key cascade; drop table TTITULOSVALORCARACTERISTICAS cascade constraints; /*==============================================================*/ /* Table: TTITULOSVALORCARACTERISTICAS */ /*==============================================================*/ create table TTITULOSVALORCARACTERISTICAS ( CTIPOPORTAFOLIO VARCHAR2(3) not null, CTIPOTITULOVALOR VARCHAR2(3) not null, CTIPOINSTRUMENTO NUMBER(2) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, CTIPOMERCADO VARCHAR2(3), CBASECALCULO VARCHAR2(14), CLASIFICACIONFASB115 VARCHAR2(15), CFRECUENCIA_REVISION NUMBER(2), TIENECUPON VARCHAR2(1) default '0', RENTAFIJAVARIABLE VARCHAR2(1) ); comment on table TTITULOSVALORCARACTERISTICAS is 'Caracteristicas de mercado del titulo valor'; comment on column TTITULOSVALORCARACTERISTICAS.CTIPOPORTAFOLIO is 'Codigo de tipo de portafolio de inversiones (Propio, De terceros)'; comment on column TTITULOSVALORCARACTERISTICAS.CTIPOTITULOVALOR is 'Codigo del tipo de titulo valor como Bono, Accion'; comment on column TTITULOSVALORCARACTERISTICAS.CTIPOINSTRUMENTO is 'Codigo del tipo de instrumento de inversiones'; comment on column TTITULOSVALORCARACTERISTICAS.FHASTA is 'Fecha hasta la que esta vigentes las caracteristicas de un titulo valor'; comment on column TTITULOSVALORCARACTERISTICAS.FDESDE is 'Fecha desde la que esta vigentes las caracteristicas de un titulo valor'; comment on column TTITULOSVALORCARACTERISTICAS.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TTITULOSVALORCARACTERISTICAS.CTIPOMERCADO is 'Codigo de tipo de mercado de inversiones'; comment on column TTITULOSVALORCARACTERISTICAS.CBASECALCULO is 'Base de calculo'; comment on column TTITULOSVALORCARACTERISTICAS.CLASIFICACIONFASB115 is 'Clasificacion FASB115 del instrumento de la inversion'; comment on column TTITULOSVALORCARACTERISTICAS.CFRECUENCIA_REVISION is 'Codigo de frecuencia de revision del diferencial de la inversion'; comment on column TTITULOSVALORCARACTERISTICAS.TIENECUPON is 'Indica si el titulo valor de inversiones maneja cupon o no'; comment on column TTITULOSVALORCARACTERISTICAS.RENTAFIJAVARIABLE is 'Indica si el instrumento de la inversion es de renta F=fija o V=variable'; alter table TTITULOSVALORCARACTERISTICAS add constraint CKTIENECUPON check (TIENECUPON is null or (TIENECUPON = upper(TIENECUPON) and TIENECUPON in ('1','0'))); alter table TTITULOSVALORCARACTERISTICAS add constraint CKRENTAFIJAVARIABLE check (RENTAFIJAVARIABLE is null or (RENTAFIJAVARIABLE = upper(RENTAFIJAVARIABLE) and RENTAFIJAVARIABLE in ('F','V'))); alter table TTITULOSVALORCARACTERISTICAS add constraint IPKTITVALCARACT primary key (CTIPOPORTAFOLIO, CTIPOTITULOVALOR, CTIPOINSTRUMENTO, FHASTA); alter table TTITULOSVALORCARACTERISTICAS add constraint FKTITVALBASCALC foreign key (CBASECALCULO) references TBASESCALCULOID (CBASECALCULO); alter table TTITULOSVALORCARACTERISTICAS add constraint FKTITVALFREQREV foreign key (CFRECUENCIA_REVISION) references TFRECUENCIASID (CFRECUENCIA); alter table TTITULOSVALORCARACTERISTICAS add constraint FKTITVALTIPINST foreign key (CTIPOTITULOVALOR, CTIPOINSTRUMENTO) references TTIPOSINSTRUMENTOID (CTIPOTITULOVALOR, CTIPOINSTRUMENTO); alter table TTITULOSVALORCARACTERISTICAS add constraint FKTITVALTIPMERC foreign key (CTIPOMERCADO) references TTIPOSMERCADOID (CTIPOMERCADO); alter table TTITULOSVALORCARACTERISTICAS add constraint FKTITVALTIPPORT foreign key (CTIPOPORTAFOLIO) references TTIPOSPORTAFOLIOID (CTIPOPORTAFOLIO); alter table TCUENTAINVERSIONESINTERESES drop constraint FKCTAINVINT; alter table TCUENTAINVERSIONESINTERESES drop primary key cascade; drop table TCUENTAINVERSIONESINTERESES cascade constraints; /*==============================================================*/ /* Table: TCUENTAINVERSIONESINTERESES */ /*==============================================================*/ create table TCUENTAINVERSIONESINTERESES ( CCUENTA VARCHAR2(19) not null, CPERSONA_COMPANIA NUMBER(8) not null, SCUENTAINVERSIONINTERESES NUMBER(4) not null, FHASTA TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, FDESDE TIMESTAMP not null, FCALCULOINTERESES DATE not null, CAPITAL NUMBER(19,6), INTERESCALCULADO NUMBER(19,6) not null, TASA NUMBER(10,6), FCONTABLE DATE, NUMEROMENSAJE VARCHAR2(30) ); comment on table TCUENTAINVERSIONESINTERESES is 'Registro de las fechas y calculo de los intereses de una inversion y su pago'; comment on column TCUENTAINVERSIONESINTERESES.CCUENTA is 'Numero de cuenta de inversiones'; comment on column TCUENTAINVERSIONESINTERESES.CPERSONA_COMPANIA is 'Codigo de la compania'; comment on column TCUENTAINVERSIONESINTERESES.SCUENTAINVERSIONINTERESES is 'Numero consecutivo del registro del calculo de intereses de la inversion'; comment on column TCUENTAINVERSIONESINTERESES.FHASTA is 'Fecha hasta la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TCUENTAINVERSIONESINTERESES.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TCUENTAINVERSIONESINTERESES.FDESDE is 'Fecha desde la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TCUENTAINVERSIONESINTERESES.FCALCULOINTERESES is 'Fecha a la que se realizo el calculo de los intereses del ultimo pago'; comment on column TCUENTAINVERSIONESINTERESES.CAPITAL is 'Capital de la inversion aplicado en el calculo del interes'; comment on column TCUENTAINVERSIONESINTERESES.INTERESCALCULADO is 'Valor del interes calculado en la fecha'; comment on column TCUENTAINVERSIONESINTERESES.TASA is 'Tasa aplicada en el calculo del interes'; comment on column TCUENTAINVERSIONESINTERESES.FCONTABLE is 'Fecha contable en la que se registra el cobro del interes de la inversion'; comment on column TCUENTAINVERSIONESINTERESES.NUMEROMENSAJE is 'Numero del mensaje en el cual se registro el cobro de los intereses'; alter table TCUENTAINVERSIONESINTERESES add constraint IPKCTAINVINT primary key (CPERSONA_COMPANIA, CCUENTA, SCUENTAINVERSIONINTERESES, FHASTA); alter table TCUENTAINVERSIONESINTERESES add constraint FKCTAINVINT foreign key (CCUENTA, CPERSONA_COMPANIA) references TCUENTAID (CCUENTA, CPERSONA_COMPANIA); alter table TCUENTAINVERSIONESCALIFICACION drop constraint FKCTAINVCALIF; alter table TCUENTAINVERSIONESCALIFICACION drop constraint FKCTAINVCALIFPER1; alter table TCUENTAINVERSIONESCALIFICACION drop constraint FKCTAINVCALIFPER2; alter table TCUENTAINVERSIONESCALIFICACION drop constraint FKCTAINVCALIFPER3; alter table TCUENTAINVERSIONESCALIFICACION drop primary key cascade; drop table TCUENTAINVERSIONESCALIFICACION cascade constraints; /*==============================================================*/ /* Table: TCUENTAINVERSIONESCALIFICACION */ /*==============================================================*/ create table TCUENTAINVERSIONESCALIFICACION ( CCUENTA VARCHAR2(19) not null, CPERSONA_COMPANIA NUMBER(8) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, CPERSONA_CALIFICADORA1 NUMBER(8), CPERSONA_CALIFICADORA2 NUMBER(8), CPERSONA_CALIFICADORA3 NUMBER(8), VERSIONCONTROL NUMBER(22) default 0 ); comment on table TCUENTAINVERSIONESCALIFICACION is 'Calificacion de riesgo dado por las instituciones calificadoras'; comment on column TCUENTAINVERSIONESCALIFICACION.CCUENTA is 'Numero de cuenta'; comment on column TCUENTAINVERSIONESCALIFICACION.CPERSONA_COMPANIA is 'Codigo de la compania a la que pertenece la cuenta, puede ser externa o compania licenciada'; comment on column TCUENTAINVERSIONESCALIFICACION.FHASTA is 'Fecha hasta la que esta vigentes la calificacion de la cuenta de inversion'; comment on column TCUENTAINVERSIONESCALIFICACION.FDESDE is 'Fecha desde la que esta vigentes la calificacion de la cuenta de inversion'; comment on column TCUENTAINVERSIONESCALIFICACION.CPERSONA_CALIFICADORA1 is 'Codigo de la persona calificadora de riesgo de la inversion'; comment on column TCUENTAINVERSIONESCALIFICACION.CPERSONA_CALIFICADORA2 is 'Codigo de la persona calificadora de riesgo de la inversion'; comment on column TCUENTAINVERSIONESCALIFICACION.CPERSONA_CALIFICADORA3 is 'Codigo de la persona calificadora de riesgo de la inversion'; comment on column TCUENTAINVERSIONESCALIFICACION.VERSIONCONTROL is 'Manejo de optimistic locking.'; alter table TCUENTAINVERSIONESCALIFICACION add constraint IPKCTAINVCALIF primary key (CCUENTA, CPERSONA_COMPANIA, FHASTA); alter table TCUENTAINVERSIONESCALIFICACION add constraint FKCTAINVCALIF foreign key (CCUENTA, CPERSONA_COMPANIA) references TCUENTAID (CCUENTA, CPERSONA_COMPANIA); alter table TCUENTAINVERSIONESCALIFICACION add constraint FKCTAINVCALIFPER1 foreign key (CPERSONA_CALIFICADORA1) references TPERSONAID (CPERSONA); alter table TCUENTAINVERSIONESCALIFICACION add constraint FKCTAINVCALIFPER2 foreign key (CPERSONA_CALIFICADORA2) references TPERSONAID (CPERSONA); alter table TCUENTAINVERSIONESCALIFICACION add constraint FKCTAINVCALIFPER3 foreign key (CPERSONA_CALIFICADORA3) references TPERSONAID (CPERSONA); alter table TEMISORESCUPOSINVERSION drop constraint FKEMICUPOINV; alter table TEMISORESCUPOSINVERSION drop constraint FKEMICUPOINVMON; alter table TEMISORESCUPOSINVERSION drop primary key cascade; drop table TEMISORESCUPOSINVERSION cascade constraints; /*==============================================================*/ /* Table: TEMISORESCUPOSINVERSION */ /*==============================================================*/ create table TEMISORESCUPOSINVERSION ( CPERSONA_EMISOR NUMBER(8) not null, CMONEDA VARCHAR2(3) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, CUPO NUMBER(19,6) not null ); comment on table TEMISORESCUPOSINVERSION is 'Cupos de inversion definidos para los emisores de titulos valor de inversiones por moneda'; comment on column TEMISORESCUPOSINVERSION.CPERSONA_EMISOR is 'Codigo de persona del emisor'; comment on column TEMISORESCUPOSINVERSION.CMONEDA is 'Codigo de moneda'; comment on column TEMISORESCUPOSINVERSION.FHASTA is 'Fecha hasta la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TEMISORESCUPOSINVERSION.FDESDE is 'Fecha desde la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TEMISORESCUPOSINVERSION.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TEMISORESCUPOSINVERSION.CUPO is 'Cupo del emisor por moneda'; alter table TEMISORESCUPOSINVERSION add constraint IPKEMICUPOINV primary key (CPERSONA_EMISOR, CMONEDA, FHASTA); alter table TEMISORESCUPOSINVERSION add constraint FKEMICUPOINV foreign key (CPERSONA_EMISOR) references TEMISORESID (CPERSONA_EMISOR); alter table TEMISORESCUPOSINVERSION add constraint FKEMICUPOINVMON foreign key (CMONEDA) references TMONEDASID (CMONEDA); alter table TTIPOSCLIENTECUPOSINVERSION drop constraint FKTIPCLICUPOINV; alter table TTIPOSCLIENTECUPOSINVERSION drop constraint FKTIPCLICUPOINVMON; alter table TTIPOSCLIENTECUPOSINVERSION drop primary key cascade; drop table TTIPOSCLIENTECUPOSINVERSION cascade constraints; /*==============================================================*/ /* Table: TTIPOSCLIENTECUPOSINVERSION */ /*==============================================================*/ create table TTIPOSCLIENTECUPOSINVERSION ( CTIPOCLIENTE VARCHAR2(3) not null, CMONEDA VARCHAR2(3) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, CUPO NUMBER(19,6) not null ); comment on table TTIPOSCLIENTECUPOSINVERSION is 'Cupos de inversion definidos por tipo de cliente y moneda para los titulos valor de inversiones'; comment on column TTIPOSCLIENTECUPOSINVERSION.CTIPOCLIENTE is 'Codigo de los tipos de cliente de una persona juridica'; comment on column TTIPOSCLIENTECUPOSINVERSION.CMONEDA is 'Codigo de moneda'; comment on column TTIPOSCLIENTECUPOSINVERSION.FHASTA is 'Fecha hasta la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TTIPOSCLIENTECUPOSINVERSION.FDESDE is 'Fecha desde la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TTIPOSCLIENTECUPOSINVERSION.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TTIPOSCLIENTECUPOSINVERSION.CUPO is 'Cupo del emisor por moneda'; alter table TTIPOSCLIENTECUPOSINVERSION add constraint IPKTIPCLICUPOINV primary key (CTIPOCLIENTE, CMONEDA, FHASTA); alter table TTIPOSCLIENTECUPOSINVERSION add constraint FKTIPCLICUPOINV foreign key (CTIPOCLIENTE) references TTIPOSCLIENTEID (CTIPOCLIENTE); alter table TTIPOSCLIENTECUPOSINVERSION add constraint FKTIPCLICUPOINVMON foreign key (CMONEDA) references TMONEDASID (CMONEDA); spool off