/*==============================================================*/ /* Database name: Database */ /* DBMS name: ORACLE Version 10g */ /* Created on: 09/11/2009 18:28:12 AM */ /*==============================================================*/ -- 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 fitbank201062004.log alter table TCUENTASPERSONADIRECCIONES drop constraint FKPERCTADIRTIPCORRESP; alter table TTIPOSCORRESPONDENCIA drop constraint FKTIPCORRESPID; alter table TTIPOSCORRESPONDENCIAID drop primary key cascade; drop table TTIPOSCORRESPONDENCIAID cascade constraints; /*==============================================================*/ /* Table: TTIPOSCORRESPONDENCIAID */ /*==============================================================*/ create table TTIPOSCORRESPONDENCIAID ( CTIPOCORRESPONDENCIA VARCHAR2(3) not null ); comment on table TTIPOSCORRESPONDENCIAID is 'Codigos de los tipos de correspondencia de las direcciones asociadas a las cuentas de la persona'; comment on column TTIPOSCORRESPONDENCIAID.CTIPOCORRESPONDENCIA is 'Codigo del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; alter table TTIPOSCORRESPONDENCIAID add constraint IPKTIPCORRESPID primary key (CTIPOCORRESPONDENCIA); alter table TTIPOSCORRESPONDENCIA drop constraint FKIDITIPCORRESP; alter table TTIPOSCORRESPONDENCIA drop constraint FKTIPCORRESPID; alter table TTIPOSCORRESPONDENCIA drop primary key cascade; drop table TTIPOSCORRESPONDENCIA cascade constraints; /*==============================================================*/ /* Table: TTIPOSCORRESPONDENCIA */ /*==============================================================*/ create table TTIPOSCORRESPONDENCIA ( CIDIOMA VARCHAR2(3) not null, CTIPOCORRESPONDENCIA VARCHAR2(3) not null, FHASTA TIMESTAMP not null, VERSIONCONTROL NUMBER default 0, FDESDE TIMESTAMP not null, DESCRIPCION VARCHAR2(10) not null ); comment on table TTIPOSCORRESPONDENCIA is 'Descripcion por idioma de los codigos de los tipos de correspondencia de las direcciones asociadas a las cuentas de la persona'; comment on column TTIPOSCORRESPONDENCIA.CIDIOMA is 'Codigo de idioma'; comment on column TTIPOSCORRESPONDENCIA.CTIPOCORRESPONDENCIA is 'Codigo del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TTIPOSCORRESPONDENCIA.FHASTA is 'Fecha hasta la que esta vigente la descripcion del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TTIPOSCORRESPONDENCIA.VERSIONCONTROL is 'Manejo de optimistic locking'; comment on column TTIPOSCORRESPONDENCIA.FDESDE is 'Fecha desde la que esta vigente la descripcion del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TTIPOSCORRESPONDENCIA.DESCRIPCION is 'Descripcion del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; alter table TTIPOSCORRESPONDENCIA add constraint IPKTIPCORRESP primary key (CIDIOMA, CTIPOCORRESPONDENCIA, FHASTA); alter table TTIPOSCORRESPONDENCIA add constraint FKIDITIPCORRESP foreign key (CIDIOMA) references TIDIOMASID (CIDIOMA); alter table TTIPOSCORRESPONDENCIA add constraint FKTIPCORRESPID foreign key (CTIPOCORRESPONDENCIA) references TTIPOSCORRESPONDENCIAID (CTIPOCORRESPONDENCIA); alter table TCUENTASPERSONADIRECCIONES drop constraint FKPERCTADIR; alter table TCUENTASPERSONADIRECCIONES drop constraint FKPERCTADIRNUMDIR; alter table TCUENTASPERSONADIRECCIONES drop constraint FKPERCTADIRTIPCORRESP; alter table TCUENTASPERSONADIRECCIONES drop primary key cascade; drop table TCUENTASPERSONADIRECCIONES cascade constraints; /*==============================================================*/ /* Table: TCUENTASPERSONADIRECCIONES */ /*==============================================================*/ create table TCUENTASPERSONADIRECCIONES ( CPERSONA NUMBER(8) not null, CCUENTA VARCHAR2(19) not null, CTIPOCORRESPONDENCIA VARCHAR2(3) not null, CPERSONA_COMPANIA NUMBER(8) not null, FHASTA TIMESTAMP not null, VERSIONCONTROL NUMBER default 0, FDESDE TIMESTAMP not null, NUMERODIRECCION NUMBER(3) ); comment on table TCUENTASPERSONADIRECCIONES is 'Registro de las direcciones asociadas a una cuenta, indicando el tipo de correspondencia que se enviara a cada persona relacionada con la cuenta. '; comment on column TCUENTASPERSONADIRECCIONES.CPERSONA is 'Codigo de la persona'; comment on column TCUENTASPERSONADIRECCIONES.CCUENTA is 'Numero de cuenta relacionada con una persona'; comment on column TCUENTASPERSONADIRECCIONES.CTIPOCORRESPONDENCIA is 'Codigo del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TCUENTASPERSONADIRECCIONES.CPERSONA_COMPANIA is 'Codigo de persona de la compania'; comment on column TCUENTASPERSONADIRECCIONES.FHASTA is 'Fecha hasta la que esta vigente la descripcion del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TCUENTASPERSONADIRECCIONES.VERSIONCONTROL is 'Manejo de optimistic locking'; comment on column TCUENTASPERSONADIRECCIONES.FDESDE is 'Fecha desde la que esta vigente la descripcion del tipo de correspondencia de las direcciones asociadas a las cuentas de una persona'; comment on column TCUENTASPERSONADIRECCIONES.NUMERODIRECCION is 'Numero de direccion'; alter table TCUENTASPERSONADIRECCIONES add constraint IPKCTAPERDIR primary key (CPERSONA, CCUENTA, CTIPOCORRESPONDENCIA, CPERSONA_COMPANIA, FHASTA); alter table TCUENTASPERSONADIRECCIONES add constraint FKPERCTADIR foreign key (CPERSONA, CPERSONA_COMPANIA, CCUENTA) references TCUENTASPERSONAID (CPERSONA, CPERSONA_COMPANIA, CCUENTA); alter table TCUENTASPERSONADIRECCIONES add constraint FKPERCTADIRNUMDIR foreign key (CPERSONA, NUMERODIRECCION) references TPERSONADIRECCIONESID (CPERSONA, NUMERODIRECCION); alter table TCUENTASPERSONADIRECCIONES add constraint FKPERCTADIRTIPCORRESP foreign key (CTIPOCORRESPONDENCIA) references TTIPOSCORRESPONDENCIAID (CTIPOCORRESPONDENCIA); spool off