/*==============================================================*/ /* Database name: Database */ /* DBMS name: ORACLE Version 10g */ /* Created on: 07/02/2010 17:46:17 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 fitbank201063010.log /*==============================================================*/ /* Table: TCUENTAINVERSIONES */ /*==============================================================*/ alter table TCUENTAINVERSIONES add ( ISINDOCUMENT VARCHAR2(20), YTMATURITY NUMBER(10,6), CPERSONA_EMISOR NUMBER(8), CPERSONA_CUSTODIO NUMBER(8), CPERSONA_VENDEDOR NUMBER(8), CCUENTA_PAGO VARCHAR2(19), CCUENTA_COBRO VARCHAR2(19)); comment on column TCUENTAINVERSIONES.ISINDOCUMENT is 'Numero internacional del documento de la inversion'; comment on column TCUENTAINVERSIONES.YTMATURITY is 'Tasa interna de rentabilidad de la inversion'; comment on column TCUENTAINVERSIONES.CPERSONA_EMISOR is 'Codigo de la persona emisor'; comment on column TCUENTAINVERSIONES.CPERSONA_CUSTODIO is 'Codigo de la persona custodio'; comment on column TCUENTAINVERSIONES.CPERSONA_VENDEDOR is 'Codigo de la persona vendedor'; comment on column TCUENTAINVERSIONES.CCUENTA_PAGO is 'Numero de cuenta nostro para el pago de la inversion'; comment on column TCUENTAINVERSIONES.CCUENTA_COBRO is 'Numero de cuenta nostro para el cobro de la inversion'; alter table TCUENTAINVERSIONES add constraint FKCTAINVCTACOB foreign key (CCUENTA_COBRO, CPERSONA_COMPANIA) references TCUENTASVISTAID (CCUENTA, CPERSONA_COMPANIA); alter table TCUENTAINVERSIONES add constraint FKCTAINVCTAPAG foreign key (CCUENTA_PAGO, CPERSONA_COMPANIA) references TCUENTASVISTAID (CCUENTA, CPERSONA_COMPANIA); alter table TCUENTAINVERSIONES add constraint FKCTAINVPERCUS foreign key (CPERSONA_CUSTODIO) references TPERSONAID (CPERSONA); alter table TCUENTAINVERSIONES add constraint FKCTAINVPEREMI foreign key (CPERSONA_EMISOR) references TPERSONAID (CPERSONA); alter table TCUENTAINVERSIONES add constraint FKCTAINVPERVEN foreign key (CPERSONA_VENDEDOR) references TPERSONAID (CPERSONA); alter table TCUENTAINVERSIONESCUPONES drop constraint FKCTAINVCUP; alter table TCUENTAINVERSIONESCUPONES drop primary key cascade; drop table TCUENTAINVERSIONESCUPONES cascade constraints; /*==============================================================*/ /* Table: TCUENTAINVERSIONESCUPONES */ /*==============================================================*/ create table TCUENTAINVERSIONESCUPONES ( CCUENTA VARCHAR2(19) not null, CPERSONA_COMPANIA NUMBER(8) not null, NUMEROCUPON NUMBER(4) not null, FHASTA TIMESTAMP not null, FDESDE TIMESTAMP not null, VERSIONCONTROL NUMBER(22) default 0, FVENCIMIENTO DATE not null, FINICIOACCRUAL DATE, TASA NUMBER(10,6), CAPITAL NUMBER(19,6), INTERES NUMBER(19,6), ESTATUSCUPON VARCHAR2(1) ); comment on table TCUENTAINVERSIONESCUPONES is 'Registro de los cupones de la cuenta de inversion'; comment on column TCUENTAINVERSIONESCUPONES.CCUENTA is 'Numero de cuenta de inversiones'; comment on column TCUENTAINVERSIONESCUPONES.CPERSONA_COMPANIA is 'Codigo de persona de la compania'; comment on column TCUENTAINVERSIONESCUPONES.NUMEROCUPON is 'Numero de cupon'; comment on column TCUENTAINVERSIONESCUPONES.FHASTA is 'Fecha hasta la que esta vigentes los datos generales de una cuenta de inversiones'; comment on column TCUENTAINVERSIONESCUPONES.FDESDE is 'Fecha desde la que esta vigentes los datos del cupon '; comment on column TCUENTAINVERSIONESCUPONES.VERSIONCONTROL is 'Manejo de optimistic locking.'; comment on column TCUENTAINVERSIONESCUPONES.FVENCIMIENTO is 'Fecha de vencimiento del cupon'; comment on column TCUENTAINVERSIONESCUPONES.FINICIOACCRUAL is 'Fecha de inicio del accrual del cupon'; comment on column TCUENTAINVERSIONESCUPONES.TASA is 'Tasa original de la cuenta ed inversiones'; comment on column TCUENTAINVERSIONESCUPONES.CAPITAL is 'Valor de capital para el cupon '; comment on column TCUENTAINVERSIONESCUPONES.INTERES is 'Valor de intereses del cupon'; comment on column TCUENTAINVERSIONESCUPONES.ESTATUSCUPON is 'Indica el estado del cupon'; alter table TCUENTAINVERSIONESCUPONES add constraint IPKCTAINVCUPON primary key (CCUENTA, CPERSONA_COMPANIA, NUMEROCUPON, FHASTA); alter table TCUENTAINVERSIONESCUPONES add constraint FKCTAINVCUP foreign key (CCUENTA, CPERSONA_COMPANIA, NUMEROCUPON) references TSUBCUENTASID (CCUENTA, CPERSONA_COMPANIA, SUBCUENTA); spool off