/*******************************************************************************
 * Selected metadata objects
 * -------------------------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

/*******************************************************************************
 * Generators
 * ----------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

CREATE GENERATOR DETALLE_SOLICITUD_CP_GEN;

SET GENERATOR DETALLE_SOLICITUD_CP_GEN TO 1;

CREATE GENERATOR GEN_PL;

SET GENERATOR GEN_PL TO 1;

CREATE GENERATOR INC_SALDOS_PENDIENTES;

SET GENERATOR INC_SALDOS_PENDIENTES TO 1;

CREATE GENERATOR INCIP;

SET GENERATOR INCIP TO 0;

CREATE GENERATOR INCLOGRELOJ;

SET GENERATOR INCLOGRELOJ TO 0;

CREATE GENERATOR INCNUMABONNE;

SET GENERATOR INCNUMABONNE TO 119467;

CREATE GENERATOR INCNUMAPPEL;

SET GENERATOR INCNUMAPPEL TO 3000000;

CREATE GENERATOR INCNUMBN;

SET GENERATOR INCNUMBN TO 15493136;

CREATE GENERATOR INCNUMBNINT;

SET GENERATOR INCNUMBNINT TO 1001633;

CREATE GENERATOR INCNUMCAMBIO;

SET GENERATOR INCNUMCAMBIO TO 10207;

CREATE GENERATOR INCNUMEC;

SET GENERATOR INCNUMEC TO 15493504;

CREATE GENERATOR INCNUMHIST;

SET GENERATOR INCNUMHIST TO 105587;

CREATE GENERATOR INCNUMID_RECHABONNE;

SET GENERATOR INCNUMID_RECHABONNE TO 3020400;

CREATE GENERATOR INCNUMIMP;

SET GENERATOR INCNUMIMP TO 10006586;

CREATE GENERATOR INCNUMITV;

SET GENERATOR INCNUMITV TO 15037634;

CREATE GENERATOR INCNUMLOGIN;

SET GENERATOR INCNUMLOGIN TO 0;

CREATE GENERATOR INCNUMLOTE;

SET GENERATOR INCNUMLOTE TO 200133138;

CREATE GENERATOR INCNUMMAIL;

SET GENERATOR INCNUMMAIL TO 0;

CREATE GENERATOR INCNUMMOUVEMENT;

SET GENERATOR INCNUMMOUVEMENT TO 106493;

CREATE GENERATOR INCNUMORDREPPV;

SET GENERATOR INCNUMORDREPPV TO 223995;

CREATE GENERATOR INCNUMPAYAV;

SET GENERATOR INCNUMPAYAV TO 3001391;

CREATE GENERATOR INCNUMRDV;

SET GENERATOR INCNUMRDV TO 3000000;

CREATE GENERATOR INCNUMRECH;

SET GENERATOR INCNUMRECH TO 901113297;

CREATE GENERATOR INCNUMRECU;

SET GENERATOR INCNUMRECU TO 1017392;

CREATE GENERATOR INCNUMROLE;

SET GENERATOR INCNUMROLE TO 114716;

CREATE GENERATOR INCNUMSOC;

SET GENERATOR INCNUMSOC TO 3;

CREATE GENERATOR INCNUMSTATRECO;

SET GENERATOR INCNUMSTATRECO TO 10700;

CREATE GENERATOR INCNUMVENTE;

SET GENERATOR INCNUMVENTE TO 15020608;

CREATE GENERATOR INCNUMVISITE;

SET GENERATOR INCNUMVISITE TO 3000001;

CREATE GENERATOR INCPAGO;

SET GENERATOR INCPAGO TO 486706;

CREATE GENERATOR INCTRANSACDLA;

SET GENERATOR INCTRANSACDLA TO 367970;

CREATE GENERATOR SOLICITUD_CABIO_PRECIO_GEN;

SET GENERATOR SOLICITUD_CABIO_PRECIO_GEN TO 1;

/*******************************************************************************
 * Domains
 * -------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

CREATE DOMAIN BARRE AS
 CHAR(18) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN BOOL AS
 CHAR(3) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN CODE AS
 CHAR(4) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN CODEBQ AS
 CHAR(5) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN COMMENTAIRE AS
 CHAR(100) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN COMPTE AS
 CHAR(6) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN CPTBQ AS
 CHAR(11) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN DAT AS
 TIMESTAMP
;

CREATE DOMAIN DOM_BOOL AS
 CHAR(1) CHARACTER SET NONE
 DEFAULT 'F'
 NOT NULL
 CHECK (value in ('F','T'))
 COLLATE NONE;

CREATE DOMAIN DOM_BOOL_I AS
 CHAR(1) CHARACTER SET NONE
 DEFAULT 'F'
 CHECK (value in ('F','T',''))
 COLLATE NONE;

CREATE DOMAIN EMETTEUR AS
 CHAR(6) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN HEURE AS
 CHAR(5) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN INSEE AS
 CHAR(5) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN JOUR AS
 CHAR(2) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN JOURNAL AS
 CHAR(3) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN LIBCOURT AS
 CHAR(10) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN LIBELLE AS
 CHAR(25) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN LIBLG AS
 CHAR(50) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN LIEU AS
 CHAR(25) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN LOGIN AS
 CHAR(10) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN MOIS AS
 CHAR(7) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN NBMOIS AS
 SMALLINT
;

CREATE DOMAIN NBPRISE AS
 INTEGER
;

CREATE DOMAIN NBRUE AS
 INTEGER
 CHECK (value > 10000)
;

CREATE DOMAIN NUMABONNE AS
 INTEGER
;

CREATE DOMAIN NUMCONVERT AS
 CHAR(12) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN NUMLOGIC AS
 SMALLINT
;

CREATE DOMAIN NUMTERMINAL AS
 CHAR(9) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN PB AS
 CHAR(8) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN PIECECPT AS
 INTEGER
;

CREATE DOMAIN PRICE AS
 DOUBLE PRECISION
;

CREATE DOMAIN PRISE AS
 CHAR(17) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN QTE AS
 DOUBLE PRECISION
;

CREATE DOMAIN QUANTITE AS
 SMALLINT
;

CREATE DOMAIN RIB AS
 CHAR(2) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN SERIE AS
 CHAR(4) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN SEXE AS
 CHAR(1) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN SIGNAL AS
 SMALLINT
;

CREATE DOMAIN STATUT AS
 CHAR(1) CHARACTER SET NONE
 DEFAULT 'P'
 NOT NULL
 CHECK (value in ('P','A','I'))
 COLLATE NONE;

CREATE DOMAIN TAUX AS
 DOUBLE PRECISION
 DEFAULT 0
 CHECK (value >= 0)
;

CREATE DOMAIN TELEPHONE AS
 CHAR(14) CHARACTER SET NONE
 COLLATE NONE;

CREATE DOMAIN ZONE AS
 CHAR(4) CHARACTER SET NONE
 COLLATE NONE;

/*******************************************************************************
 * Tables
 * ------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

CREATE TABLE ABONNE
(
  NUMABONNE                 NUMABONNE NOT NULL,
  NUMSOUSCRIPT              NUMABONNE ,
  NUMCONTRAT                NUMABONNE ,
  GENRE                          SEXE ,
  NOM                         VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  LGT                         VARCHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODINSEE                    JOURNAL ,
  ADRESSE                     VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  BOITPOST                    VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  TELDOM                      VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  TELBURO                     VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  TELCEL                      VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  DTABON                          DAT ,
  DTSAISIE                        DAT ,
  LETWLC                         BOOL ,
  CODOPE                        LOGIN ,
  RUTA                        NBPRISE ,
  CBOR                           CODE ,
  NATION                      VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  CAUTION                       PRICE ,
  TRAVAIL                     VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  CODRGT                         CODE ,
  NUMTVA                      VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  SOLDE                         PRICE ,
  LOCALIZATION                  INSEE ,
  CEDULA                      VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  NUMID                     NUMABONNE ,
  INTERNET                    VARCHAR(    60) CHARACTER SET NONE  COLLATE NONE,
  HABITACION                 SMALLINT,
  LIMITPPV                      PRICE ,
  ASUJETIV                   DOM_BOOL ,
  VENCELGT                  TIMESTAMP,
  TIPO                        VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  NITREAL                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  NUME_HOGAR                  VARCHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  CPROV                       VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CCANTON                     VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CDISTRI                     VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CLAVEDLA                    VARCHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  TIPOFACT                       CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  TEMPORAL                    INTEGER,
  TELFAX                      VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  MULTA                      DOM_BOOL ,
  GESTION                     VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  MOTIVO_GESTION              VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  FECHA_GESTION             TIMESTAMP,
  GESTOR                      VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT ABONNEPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE ABONNE_HIST
(
  PERIODE                   CHAR(     7) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMABONNE            NUMABONNE NOT NULL,
  SOLD1                    PRICE NOT NULL,
  SOLD2                    PRICE NOT NULL,
  SOLD3                    PRICE NOT NULL,
  SOLD4                    PRICE NOT NULL,
  SOLD5                    PRICE NOT NULL,
  ESTADO                    CHAR(     1) CHARACTER SET NONE NOT NULL COLLATE NONE,
  LGT                       CHAR(     4) CHARACTER SET NONE NOT NULL COLLATE NONE,
  OPTICNODE              VARCHAR(     9) CHARACTER SET NONE NOT NULL COLLATE NONE,
  DTRESI               TIMESTAMP,
  CODRESI                   CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT ABONNE_HISTPRIMARYKEY1 PRIMARY KEY (PERIODE, NUMABONNE)
)
;

CREATE TABLE ABONNEPPV
(
  NUMORDREPPV              NUMABONNE NOT NULL,
  NUMABONNE                NUMABONNE ,
  DTSAISIE                       DAT ,
  NUMTRANSACDLA            NUMABONNE ,
  NUMEVENT                   INTEGER,
  NUMSERIE                      CHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  DTFACT                   TIMESTAMP,
 CONSTRAINT ABONNEPPVPRIMARYKEY1 PRIMARY KEY (NUMORDREPPV)
)
;

CREATE TABLE ABONNEPPVPROB
(
  NUMORDREPPV            NUMABONNE NOT NULL,
  DTSAISIE                     DAT ,
  NUMSERIE                    CHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  NUMABONNE                INTEGER,
 CONSTRAINT ABONNEPPVPROBPRIMARYKEY1 PRIMARY KEY (NUMORDREPPV)
)
;

CREATE TABLE ACTUALIZACION
(
  NUMABONNE            NUMABONNE NOT NULL,
  OPTICNODE              VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  NUMTAP                 VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  SORTIETAP             SMALLINT,
 CONSTRAINT ACTUALIZACIONPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE AG
(
  NUMABONNE            NUMABONNE NOT NULL,
  SOLD1                    PRICE ,
  SOLD2                    PRICE ,
  SOLD3                    PRICE ,
  SOLD4                    PRICE ,
  SOLD5                    PRICE ,
 CONSTRAINT AGPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE AMNETINFO
(
  FICHEID                    INTEGER         NOT NULL,
  PRECIOS                       BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  CANALES                       BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  NOTICIAS                      BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  TELEFONO                      BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  PROMOCION                     BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  AVERIAS                       BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  COBERINTERNET                 BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  VENTAS                        BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  RHUMANO                       BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  INFOLOGIC                     BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
  INFORADIOS                    BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET NONE,
 CONSTRAINT AMNETINFOPRIMARYKEY1 PRIMARY KEY (FICHEID)
)
;

CREATE TABLE AVERINTERNET
(
  NUMLLAMADA               INTEGER         NOT NULL,
  NUMABONNE                INTEGER         NOT NULL,
  NUMOT                    INTEGER,
  FECHAINI               TIMESTAMP,
  HORAINI                  VARCHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  USUARIOINI               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MOTIVO                   VARCHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  RESPUESTA                VARCHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  OBSERVACION              VARCHAR(  4096) CHARACTER SET NONE  COLLATE NONE,
  ESTADO                      CHAR(     1) CHARACTER SET NONE NOT NULL COLLATE NONE,
  GRUPOLATE                VARCHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  FECHAFINAL             TIMESTAMP,
  HORAFINAL                VARCHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  USUARIOFIN               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  NUMCASO                  INTEGER,
  PRIORIDAD                INTEGER,
 CONSTRAINT AVERINTERNETPRIMARYKEY1 PRIMARY KEY (NUMLLAMADA)
)
;

CREATE TABLE BITACORA_NODOS
(
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMNODE                     VARCHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
  FECHA                     TIMESTAMP         NOT NULL,
  HORA                        INTEGER         NOT NULL,
  ESTADO                      INTEGER         NOT NULL,
  USUARIO                     VARCHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
  COMENTARIO                  VARCHAR(   250) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (CODIGO_HEADEND, CODIGO_HUB, NUMNODE, FECHA, HORA, ESTADO)
)
;

CREATE TABLE BLOCNOTE
(
  NUMBN                NUMABONNE NOT NULL,
  NUMABONNE            NUMABONNE ,
  DTSAISIE                   DAT ,
  LIB                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CODOPE                 VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT BLOCNOTEPRIMARYKEY1 PRIMARY KEY (NUMBN)
)
;

CREATE TABLE CABLEMODEMSERV
(
  ORDRE                    INTEGER         NOT NULL,
  NUMSERIE                 VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  MACADDRESS               VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  TIPOEQUIPO               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FECHAVENCIM            TIMESTAMP,
  PROPIETARIO              VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  NUMCLIALOPA              VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  POLITICA                    CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PK_SERVCM PRIMARY KEY (ORDRE)
)
;

CREATE TABLE CAJACAJERO
(
  NUMMOUVEMENT                     NUMABONNE NOT NULL,
  HEURE                                HEURE ,
  DTCPT                                  DAT ,
  CASHIER                              LOGIN ,
  CASHEFECTIVOCOL                      PRICE ,
  CASHEFECTIVODOL                      PRICE ,
  CASHCHEQUECOL                        PRICE ,
  CASHCHEQUEDOL                        PRICE ,
  CASHBANCODEPOSIT                     PRICE ,
  CASHDIFER                            PRICE ,
  CASHVOUCHERCREST                     PRICE ,
  CASHVOUCHERCREDOMATIC                PRICE ,
  CASHVOUCHERAVAL                      PRICE ,
  CASHDIFERCANAL                       PRICE ,
  CASHDIFERSISTEMAS                    PRICE ,
  COMMENT                               CHAR(   200) CHARACTER SET NONE  COLLATE NONE,
  CAMBIO                               PRICE ,
  COMISION                             PRICE ,
  DIFERCAMBIO                          PRICE ,
  DIFERCORTE                           PRICE ,
  PCOBRAREMPLEA                        PRICE ,
  DIFERCAJERO                          PRICE ,
 CONSTRAINT CAJACAJEROPRIMARYKEY1 PRIMARY KEY (NUMMOUVEMENT)
)
;

CREATE TABLE CAJAPRINC
(
  NUMMOUVEMENT                     NUMABONNE NOT NULL,
  HEURE                                HEURE ,
  CODOPE                               LOGIN ,
  DTCPT                                  DAT ,
  NUMLOTE                            VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  CASHIER                              LOGIN ,
  TOTEFECTIVO                          PRICE ,
  TOTCHEQUE                            PRICE ,
  TOTBANCRECEN                         PRICE ,
  TOTCREDOMATIC                        PRICE ,
  TOTAVAL                              PRICE ,
  TOTOTRO                              PRICE ,
  TOTCREST                             PRICE ,
  TOTBANCO                             PRICE ,
  CASHEFECTIVOCOL                      PRICE ,
  CASHEFECTIVODOL                      PRICE ,
  CASHCHEQUECOL                        PRICE ,
  CASHCHEQUEDOL                        PRICE ,
  CASHBANCODEPOSIT                     PRICE ,
  CASHDIFER                            PRICE ,
  CASHVOUCHERCREST                     PRICE ,
  CASHVOUCHERCREDOMATIC                PRICE ,
  CASHVOUCHERAVAL                      PRICE ,
  CASHDIFERCANAL                       PRICE ,
  CASHDIFERSISTEMAS                    PRICE ,
  COMMENT                               CHAR(   200) CHARACTER SET NONE  COLLATE NONE,
  CAMBIO                               PRICE ,
  COMISION                             PRICE ,
  TOTBSJ                               PRICE ,
  DIFERCAMBIO                          PRICE ,
  DIFERCORTE                           PRICE ,
  PCOBRAREMPLEA                        PRICE ,
  DIFERCAJERO                          PRICE ,
  TIPO                                  CHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  OFICINA                               CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  AVALMILLAS                           PRICE ,
  TOTAVALMILLAS                        PRICE ,
  CASHAVALMILLAS                       PRICE ,
  DIFERAVALMILLAS                      PRICE ,
 CONSTRAINT CAJAPRINCPRIMARYKEY1 PRIMARY KEY (NUMMOUVEMENT)
)
;

CREATE TABLE CAMBIOCOLILLA
(
  NUMCAMBIO               NUMABONNE NOT NULL,
  NUMABONNE               NUMABONNE NOT NULL,
  NUMSOUSCRIPT            NUMABONNE ,
  NOM                       VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  DTSAISIE                      DAT ,
  CODOPE                    VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT CAMBIOCOLILLAPRIMARYKEY1 PRIMARY KEY (NUMCAMBIO)
)
;

CREATE TABLE CANTONES
(
  CCANTON              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NCANTON              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CPROV                VARCHAR(     2) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CPAIS                VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
 PRIMARY KEY (CCANTON, CPROV, CPAIS)
)
;

CREATE TABLE CDDTRCONDI
(
  NUMABONNE              INTEGER,
  OFICIAL                   CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FECHA                TIMESTAMP,
  ESTCTA                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  INST                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  AVE                    VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  TEXT                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  TINST                  VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  DEV                    VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  DES                    VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  RECO                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  PREM                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  STEC                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  SALDO                  VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  VENTAS                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  VARIOS                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  OBSERV                 VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  TELEFONO               VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  EMISOR                 VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CMBTAR                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  EXCTAR                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  INCTAR                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE CIUDADES
(
  CODIGO                   INTEGER         NOT NULL,
  DESCRIPCION              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PK1 PRIMARY KEY (CODIGO)
)
;

CREATE TABLE CLOSING
(
  DTCLOS                  DAT NOT NULL,
 CONSTRAINT CLOSINGPRIMARYKEY1 PRIMARY KEY (DTCLOS)
)
;

CREATE TABLE COMMUNE
(
  CODINSEE              JOURNAL NOT NULL,
  NOM                   LIBELLE ,
  NBPREV                NBPRISE ,
  NUMSOC               NUMLOGIC NOT NULL,
 CONSTRAINT COMMUNEPRIMARYKEY1 PRIMARY KEY (CODINSEE)
)
;

CREATE TABLE COMPTA
(
  PERIODE                 MOIS NOT NULL,
  CAMBIO                 PRICE ,
  STATUS                  CODE ,
 CONSTRAINT COMPTAPRIMARYKEY1 PRIMARY KEY (PERIODE)
)
;

CREATE TABLE COMPTE
(
  CPTNUM              VARCHAR(    20) CHARACTER SET NONE NOT NULL COLLATE NONE,
  LIB                 VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE CONFIGURACION
(
  DESC3                         PRICE ,
  DESC6                         PRICE ,
  DESC9                         PRICE ,
  DESC12                        PRICE ,
  TIPOMULTA                      CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  MULTA                         PRICE ,
  PASSENCRYP                     CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  AVALMILLAS                    PRICE ,
  AVALMONTO                     PRICE ,
  FACTORAVAL                    PRICE ,
  RUTA_PPV_WIN                VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
  RUTA_PPV_LINUX              VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
  ALOPA                      DOM_BOOL ,
  PNODESCO                       CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  PDESCOTRAS                     CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  PDESCONORM                     CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  COD_DEPOSITO                   CODE ,
  COST_INS                       CODE
)
;

CREATE TABLE CONTACTOS
(
  NUMCONTACTO              INTEGER         NOT NULL,
  NUMABONNE                INTEGER         NOT NULL,
  NOMBRE                   VARCHAR(    50) CHARACTER SET NONE NOT NULL COLLATE NONE,
  TELEFONO1                VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  TELEFONO2                VARCHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
  EMAIL                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  APARTADO                 VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE CONTRAT
(
  TYPCTRT                      CODE ,
  DTLASTMODIF                   DAT ,
  DTRESI                        DAT ,
  CODRESI                      CODE ,
  CODRGT                       CODE ,
  CODVDS                       CODE ,
  CODPROV                      CODE ,
  COMMENT                   VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  NUMABONNE               NUMABONNE NOT NULL,
  AMPLIACION                   CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  INSINMEDIATA                 CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  TIPOTRABAJO                  CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT CONTRATPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE CORREOS
(
  NUMMAIL                 INTEGER         NOT NULL,
  ORDRE                   INTEGER,
  NUMINTER                INTEGER,
  LOGIN                   VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  DOMINIO                 VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  PASSWD                  VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  CAPACITY                  PRICE ,
  ESTADO                     CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  DTSAISIE                    DAT ,
  DTMENS                      DAT ,
  DTRESI                      DAT ,
  MOVIMIENTO                 CHAR(     3) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (NUMMAIL)
)
;

CREATE TABLE CREDFISCAL
(
  NUMABONNE              NUMABONNE NOT NULL,
  NUMREGISTRO              VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  ACTIVIDAD                VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE DECOLUNES
(
  NUMABONNE            NUMABONNE NOT NULL,
  SALDO                    PRICE ,
  CODOPE                   LOGIN ,
  DTSAISIE             TIMESTAMP,
  NOM                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  JOUR                   VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  CODINSEE                 INSEE ,
 CONSTRAINT DECOLUNESPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE DEMENAGE
(
  NUMABONNE               NUMABONNE NOT NULL,
  ADRESSE               COMMENTAIRE ,
  CODINSEE                    INSEE ,
  TELDOM                  TELEPHONE ,
  DTRACC                        DAT ,
  CODINT                       CODE ,
  COMMENT               COMMENTAIRE ,
  LOCA                         CHAR(    11) CHARACTER SET NONE  COLLATE NONE,
  LOCALIZATION                 CHAR(    11) CHARACTER SET NONE  COLLATE NONE,
  OPTICNODE                LIBCOURT ,
 CONSTRAINT DEMENAGEPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE DEPOSITOS
(
  NUMABONNE              INTEGER         NOT NULL,
  DEPOSITO                 PRICE NOT NULL,
  ESTADO                DOM_BOOL ,
  RECIBO                 INTEGER,
  CODOPE                 VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FECHA                TIMESTAMP,
 CONSTRAINT DEPOSITOS_PK PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE DERECHOS_REPORTE
(
  GRUPO                   CODE ,
  REPORTE              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE DETALLE_SOLICITUD_CP
(
  ID_DETALLE                INTEGER         NOT NULL,
  ID_SOLICITUD              INTEGER         NOT NULL,
  ORDRE                     INTEGER         NOT NULL,
  CODPROD                      CHAR(     4) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUEVO_PRECIO                PRICE NOT NULL,
 CONSTRAINT PK_DETALLE_SOLICITUD_CP PRIMARY KEY (ID_DETALLE)
)
;

CREATE TABLE DETEC
(
  NUMPIECE             PIECECPT NOT NULL,
  CODPROD                  CODE NOT NULL,
  MTT                     PRICE ,
  CODTVA                   CODE ,
  NUMJRNL               JOURNAL ,
  CANTIDAD              INTEGER,
 CONSTRAINT DETECPRIMARYKEY1 PRIMARY KEY (NUMPIECE, CODPROD)
)
;

CREATE TABLE DETECHQ
(
  NUMPIECE                    PIECECPT NOT NULL,
  NUMCHQ                      LIBCOURT ,
  BANKCHQ                      LIBELLE ,
  EMISOR                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  NUMCARD                      VARCHAR(    16) CHARACTER SET NONE  COLLATE NONE,
  NUMAUTORIZ                   VARCHAR(    16) CHARACTER SET NONE  COLLATE NONE,
  TARJETAHABIENTE              VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  MILLAS                         PRICE ,
  PAQUETE                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT DETECHQPRIMARYKEY1 PRIMARY KEY (NUMPIECE)
)
;

CREATE TABLE DETINTER
(
  NUMINTER              NUMABONNE NOT NULL,
  CODPROD                    CODE NOT NULL,
  QTEDMD                 SMALLINT,
  MOVIMIENTO                 CHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  ESTADO                 DOM_BOOL ,
  ORDREVTE                INTEGER         NOT NULL,
  TIPO                    VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  MOTIVO                     CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT DETINTERPRIMARYKEY1 PRIMARY KEY (NUMINTER, ORDREVTE)
)
;

CREATE TABLE DETINTER_TEMP
(
  NUMINTER              NUMABONNE NOT NULL,
  ORDRE                   INTEGER         NOT NULL,
  NUMSERIE                   CHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  CODPROD                    CODE NOT NULL,
  TIPOACCION                 CHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  ACCRESULT               VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  OPTICNODE              LIBCOURT
)
;

CREATE TABLE DETINTERMAT
(
  NUMINTER            NUMABONNE NOT NULL,
  CODMAT                   CHAR(     9) CHARACTER SET NONE NOT NULL COLLATE NONE,
  QTEINST              SMALLINT,
 CONSTRAINT DETINTERMATPRIMARYKEY1 PRIMARY KEY (NUMINTER, CODMAT)
)
;

CREATE TABLE DICO
(
  OBJID                    INTEGER,
  "VERSION"               SMALLINT,
  "NAME"                   VARCHAR(    31) CHARACTER SET NONE  COLLATE NONE,
  ALIASNAME                VARCHAR(    31) CHARACTER SET NONE  COLLATE NONE,
  TYPEID                   INTEGER,
  MISCINFO1                INTEGER,
  MISCINFO2                INTEGER,
  SRCOBJID                 INTEGER,
  SRCVERSION              SMALLINT,
  DESTOBJID                INTEGER,
  DESTVERSION             SMALLINT,
  OUTOFDATE                VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  CREATEDATE             TIMESTAMP,
  LASTUPDATE             TIMESTAMP,
  INFOBLOB                    BLOB SUB_TYPE 0 SEGMENT SIZE 80,
  MISCINFO3                INTEGER
)
;

CREATE TABLE DISTRITOS
(
  CDISTRI              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NDISTRI              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CCANTON              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CPROV                VARCHAR(     2) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CPAIS                VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
 PRIMARY KEY (CDISTRI, CCANTON, CPROV, CPAIS)
)
;

CREATE TABLE DROITS
(
  DROIT                           CODE NOT NULL,
  LIB                          LIBELLE ,
  SOCIO                       DOM_BOOL ,
  NUEVOSOCIO                  DOM_BOOL ,
  CONSULTSOCIO                DOM_BOOL ,
  MODIFSOCIO                  DOM_BOOL ,
  MODIFINTERNET               DOM_BOOL ,
  CAMBIOSERV                  DOM_BOOL ,
  REACTIV                     DOM_BOOL ,
  COMPLETEOT                  DOM_BOOL ,
  MODIFOT                     DOM_BOOL ,
  DESCO                       DOM_BOOL ,
  RECO                        DOM_BOOL ,
  TRASLADO                    DOM_BOOL ,
  COLILLA                     DOM_BOOL ,
  CONTA                       DOM_BOOL ,
  FACTURA                     DOM_BOOL ,
  PAGOCONLOTE                 DOM_BOOL ,
  REIMBULSO                   DOM_BOOL ,
  NOTACRED                    DOM_BOOL ,
  DEVUELTO                    DOM_BOOL ,
  NOTADEBITO                  DOM_BOOL ,
  PAGOSINLOTE                 DOM_BOOL ,
  RECONCIL                    DOM_BOOL ,
  LOTECAJA                    DOM_BOOL ,
  TRANSFCAJA                  DOM_BOOL ,
  CIERRE                      DOM_BOOL ,
  LOTENC                      DOM_BOOL ,
  TRANSFNC                    DOM_BOOL ,
  EDICION                     DOM_BOOL ,
  EDTCOBRADOR                 DOM_BOOL ,
  EXPORT                      DOM_BOOL ,
  PREMIUM                     DOM_BOOL ,
  TERMINAL                    DOM_BOOL ,
  PELICULAS                   DOM_BOOL ,
  COBRADOR                    DOM_BOOL ,
  MODIFLOTECOB                DOM_BOOL ,
  MODIFCOB                    DOM_BOOL ,
  COBCREARCHIVO               DOM_BOOL ,
  COBTRANSARCHIVO             DOM_BOOL ,
  FACTPRORAT                  DOM_BOOL ,
  RED                         DOM_BOOL ,
  FACTURACION                 DOM_BOOL ,
  EDTSOCIO                    DOM_BOOL ,
  EDTCLIENTE                  DOM_BOOL ,
  EDTCONTA                    DOM_BOOL ,
  EDTRED                      DOM_BOOL ,
  EDTDIVERSO                  DOM_BOOL ,
  EDTOT                       DOM_BOOL ,
  ADMINISTRACION              DOM_BOOL ,
  AGENDA                      DOM_BOOL ,
  PARAMETRO                   DOM_BOOL ,
  DECOFALTAPAGO               DOM_BOOL ,
  CAMBIODIR                   DOM_BOOL ,
 CONSTRAINT DROITSPRIMARYKEY1 PRIMARY KEY (DROIT)
)
;

CREATE TABLE ECRITCPT
(
  NUMPIECE                 PIECECPT NOT NULL,
  NUMABONNE               NUMABONNE ,
  PERIODE                      MOIS ,
  DTCPT                         DAT ,
  DTSAISIE                      DAT ,
  NUMJRNL                   JOURNAL ,
  LIB                       VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  NUMFACT                  PIECECPT ,
  MTTDEB                      PRICE ,
  MTTCRED                     PRICE ,
  MDRGLT                       CODE ,
  MOTIFIMP                     CODE ,
  CODOPE                   LIBCOURT ,
  ENCAISSE                    PRICE ,
  RESTE                       PRICE ,
  CODINSEE                    INSEE ,
  TYPEC                        CODE ,
  CBOR                         CODE ,
  RESUMANU                  INTEGER,
  NUMLOTE                   VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  NUMFACTURA                INTEGER,
  RECONCIL                 DOM_BOOL ,
  IMPRESO                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  WORKTO                       CODE ,
  FACTURA                   VARCHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  FECHA_DESDE             TIMESTAMP,
  FECHA_HASTA             TIMESTAMP,
  CODIGODEPAGO              INTEGER,
 CONSTRAINT ECRITCPTPRIMARYKEY1 PRIMARY KEY (NUMPIECE)
)
;

CREATE TABLE ESTADO_NODO
(
  ESTADO               INTEGER         NOT NULL,
  DETALLE              VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  TIPO                 VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (ESTADO)
)
;

CREATE TABLE ESTCTA_031
(
  NUMABONNE                   NUMABONNE NOT NULL,
  NUMSOUSCRIPT                NUMABONNE ,
  NOM                           VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  ADRESSE                       VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  PERIODE                          MOIS ,
  DT                                DAT ,
  TITULOSALDO                   VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  SOLDMESANTES                    PRICE ,
  SERVICIO1                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT1                        PRICE ,
  SERVICIO2                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT2                        PRICE ,
  SERVICIO3                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT3                        PRICE ,
  SERVICIO4                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT4                        PRICE ,
  NUEVOSALDO                      PRICE ,
  RUTA                          NBPRISE ,
  VENCIMIENTO                       DAT ,
  TELDOM                        VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  DESDE                             DAT ,
  HASTA                             DAT ,
  MTT5                            PRICE ,
  CBOR                             CODE ,
  PAGODESPUES                     PRICE ,
  MULTAPLICADA                     CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  NUEVOSALDOCOL                   PRICE ,
  PAGOOFICINA                      CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FACTURA                       INTEGER,
  SERVICIO5                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT5                        PRICE ,
  SERVICIO6                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT6                        PRICE ,
  SERVICIO7                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT7                        PRICE ,
  SERVICIO8                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT8                        PRICE ,
  SERVICIO9                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT9                        PRICE ,
  SERVICIO10                    VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT10                       PRICE ,
  MULTA                           PRICE ,
  FACTURA_TC                    INTEGER,
  MONTO_MULTA                     PRICE ,
  MONTO_FACTURA                   PRICE ,
  MONTO_FACTURA_TC                PRICE ,
  NOTA_CRED1                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CRED1                  PRICE ,
  NOTA_CRED2                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CRED2                  PRICE ,
  NOTA_CRED3                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CRED3                  PRICE ,
  NOTA_CREDTC1                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CREDTC1                PRICE ,
  NOTA_CREDTC2                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CREDTC2                PRICE ,
  NOTA_CREDTC3                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MTT_NOTA_CREDTC3                PRICE ,
  QTYS1                        SMALLINT,
  QTYS2                        SMALLINT,
  QTYS3                        SMALLINT,
  QTYS4                        SMALLINT,
  QTYS5                        SMALLINT,
  QTYS6                        SMALLINT,
  QTYS7                        SMALLINT,
  QTYS8                        SMALLINT,
  QTYS9                        SMALLINT,
  QTYS10                       SMALLINT,
  TOTAL_IMPUESTOS                 PRICE ,
  ASUJETI                          CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  MONTOMES                        PRICE ,
  DESDE1                            DAT ,
  HASTA1                            DAT ,
  CODPROD1                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD2                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD3                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD4                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD5                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD6                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD7                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD8                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD9                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  CODPROD10                        CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  ASUJETIV                     DOM_BOOL ,
  ULT_PAGO                    TIMESTAMP
)
;

CREATE TABLE FACTRECIBO
(
  NUMABONNE                NUMABONNE NOT NULL,
  NUMSOUSCRIPT             NUMABONNE ,
  NOMBREPAGADOR              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  ADRESSE                    VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  PERIODE                       MOIS ,
  RUTA                       NBPRISE ,
  TELDOM                     VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  NOMBRECBOR                 VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERV0                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT0                         PRICE ,
  MTT0G                        PRICE ,
  MTTDOL0                      PRICE ,
  SERV1                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT1                         PRICE ,
  MTT1G                        PRICE ,
  MTTDOL1                      PRICE ,
  SERV2                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT2                         PRICE ,
  MTT2G                        PRICE ,
  MTTDOL2                      PRICE ,
  SERV3                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT3                         PRICE ,
  MTT3G                        PRICE ,
  MTTDOL3                      PRICE ,
  SERV4                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT4                         PRICE ,
  MTT4G                        PRICE ,
  MTTDOL4                      PRICE ,
  SERV5                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT5                         PRICE ,
  MTT5G                        PRICE ,
  MTTDOL5                      PRICE ,
  SERV6                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT6                         PRICE ,
  MTT6G                        PRICE ,
  MTTDOL6                      PRICE ,
  SERV7                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT7                         PRICE ,
  MTT7G                        PRICE ,
  MTTDOL7                      PRICE ,
  SERV8                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT8                         PRICE ,
  MTT8G                        PRICE ,
  MTTDOL8                      PRICE ,
  SERV9                      VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT9                         PRICE ,
  MTT9G                        PRICE ,
  MTTDOL9                      PRICE ,
  SERV10                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT10                        PRICE ,
  MTT10G                       PRICE ,
  MTTDOL10                     PRICE ,
  SERV11                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT11                        PRICE ,
  MTT11G                       PRICE ,
  MTTDOL11                     PRICE ,
  TVAPROD                      PRICE ,
  TOTALAPAGAR                  PRICE ,
  DESDEHASTA                 VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  FECHASPAGOS                   CHAR(    36) CHARACTER SET NONE  COLLATE NONE,
  FACTURA                    INTEGER,
 CONSTRAINT FACTRECIBOPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE HEADEND
(
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NOMBRE_HEADEND              VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (CODIGO_HEADEND)
)
;

CREATE TABLE HISTERMINAL
(
  NUMHIST                     INTEGER         NOT NULL,
  NUMSERIE                       CHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  NUMABONNE                 NUMABONNE ,
  FECHAMOVI                       DAT ,
  CODOPE                      VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  TIPOMOVIMIENTO                 CHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  COMMENT                     VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT HISTERMINALPRIMARYKEY1 PRIMARY KEY (NUMHIST)
)
;

CREATE TABLE HISTORICO_NUMCONTRAT
(
  NUMABONNE                     INTEGER         NOT NULL,
  NUMCONTRAT_VIEJO              INTEGER,
  NOM                           VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PK_HISTORICO_NUMCONTRAT PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE HUB
(
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NOMBRE_HUB                  VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
 PRIMARY KEY (CODIGO_HUB, CODIGO_HEADEND)
)
;

CREATE TABLE IMPAYE
(
  NUMIMP               NUMABONNE NOT NULL,
  NUMPIECE              PIECECPT NOT NULL,
  NUMABONNE            NUMABONNE NOT NULL,
  PERIODE                    DAT ,
  MTT                      PRICE ,
  MOTIF                     CODE ,
  LIB                    LIBELLE ,
  DTPAIE               TIMESTAMP,
  ESTADO                DOM_BOOL ,
 CONSTRAINT IMPAYEPRIMARYKEY1 PRIMARY KEY (NUMIMP)
)
;

CREATE TABLE INTERNET
(
  NUMABONNE                  NUMABONNE NOT NULL,
  SYSTEMEOPE                   VARCHAR(    11) CHARACTER SET NONE  COLLATE NONE,
  RACSANAME                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  EQUIPEMENT                   VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  CONTACTO                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  LOGINCOMMUT                  VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CABLEMODEM                   VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  RACSANUMCONTRAT              INTEGER,
  TIPOCABLEMODEM                  CHAR(     6) CHARACTER SET NONE  COLLATE NONE,
  USERNAME                     VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  FECHAVENCE                 TIMESTAMP,
  ORDRE                        INTEGER,
 CONSTRAINT INTERNETPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE INTERVENANT
(
  CODINT                    CODE NOT NULL,
  NOM                    VARCHAR(    40),
  ACTIVIDAD                 BOOL ,
  TIPO                      CODE ,
  CODINSEE                  CHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  PRIORIDAD              INTEGER,
  EMAIL                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  MSGCORTO               VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CLAVE                  VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  COMISION                 FLOAT,
  COBRA                 DOM_BOOL ,
  ENLINEA               DOM_BOOL ,
 CONSTRAINT INTERVENANTPRIMARYKEY1 PRIMARY KEY (CODINT)
)
;

CREATE TABLE INTERVENTION
(
  NUMINTER                  NUMABONNE NOT NULL,
  NUMABONNE                 NUMABONNE ,
  DTDEB                           DAT ,
  DTFIN                           DAT ,
  HEURE                         HEURE ,
  OPESAISIE                     LOGIN ,
  OPEMODIF                      LOGIN ,
  MOTIF                          CODE ,
  PANNE                          CODE ,
  REPONSE                        CODE ,
  SIEGE                          CODE ,
  INTERVENANT                    CODE ,
  DETMOTIF                      LIBLG ,
  DETPANNE                      LIBLG ,
  DETREP                        LIBLG ,
  LIB                         LIBELLE ,
  NUMRDV                    NUMABONNE ,
  LATE                           CODE ,
  HEUREDEB                      HEURE ,
  HEUREFIN                      HEURE ,
  DTCLOS                          DAT ,
  DTEDTOR                         DAT ,
  HRCLOS                        HEURE ,
  TRASDEB                       HEURE ,
  TRASFIN                       HEURE ,
  TIPO                           CODE ,
  DTOTAVERIA                TIMESTAMP,
  GRUPOLATE                      CODE ,
  ESTADO                     DOM_BOOL ,
  ROLLINICIAL               TIMESTAMP,
  ROLLFINAL                 TIMESTAMP,
  TIPOINSTAL                     CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  FECH_CHG_GRUPO            TIMESTAMP,
  HORA_CHG_GRUPO                 CHAR(     5) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT INTERVENTIONPRIMARYKEY1 PRIMARY KEY (NUMINTER)
)
;

CREATE TABLE IPSERV
(
  NUMIP                   INTEGER         NOT NULL,
  ORDRE                   INTEGER         NOT NULL,
  BLOCKIP                 VARCHAR(    19) CHARACTER SET NONE  COLLATE NONE,
  ETHERNETIP              VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  MASKIP                  VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  RFIP                    VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  CODELUGAR                  CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  NUMLUGAR               SMALLINT,
 PRIMARY KEY (NUMIP)
)
;

CREATE TABLE JOURNAL
(
  NUMJRNL               JOURNAL NOT NULL,
  LIB                   LIBELLE ,
  TIPOJRNL                 CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TABLE1PRIMARYKEY1 PRIMARY KEY (NUMJRNL)
)
;

CREATE TABLE LATE
(
  CODLATE                 CODE NOT NULL,
  LIB                  LIBELLE ,
 CONSTRAINT LATEPRIMARYKEY1 PRIMARY KEY (CODLATE)
)
;

CREATE TABLE LINEUP
(
  NUMCANAL              INTEGER         NOT NULL,
  NOM                   LIBELLE ,
 CONSTRAINT LINEUPPRIMARYKEY1 PRIMARY KEY (NUMCANAL)
)
;

CREATE TABLE LOCALIZACION_NODO
(
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODINSEE                      INSEE NOT NULL,
  LOCALISATION                  INSEE NOT NULL,
  NUMNODE                    LIBCOURT NOT NULL,
 PRIMARY KEY (CODIGO_HEADEND, CODIGO_HUB, CODINSEE, LOCALISATION, NUMNODE)
)
;

CREATE TABLE LOCALIZATION
(
  CODINSEE                    INSEE NOT NULL,
  LOCALISATION                INSEE NOT NULL,
  LIB                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  PRINTO                       CODE ,
  CPAIS                     VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CPROV                     VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CCANTON                   VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CDISTRI                   VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
 PRIMARY KEY (CODINSEE, LOCALISATION)
)
;

CREATE TABLE LOGINS
(
  NUMLOGIN              INTEGER         NOT NULL,
  ORDRE                 INTEGER,
  PASSWD                VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  DTSAISIE                  DAT ,
  USUARIO               VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (NUMLOGIN)
)
;

CREATE TABLE LOGRELOJ
(
  ID                    INTEGER         NOT NULL,
  LOGIN                    CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  AUTORIZA                 CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FECHA               TIMESTAMP,
  HORA                     CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MINUTOS               INTEGER
)
;

CREATE TABLE LOTE_DESC_RACSA
(
  ORDRE                    INTEGER         NOT NULL,
  FECHA_CARGA            TIMESTAMP,
  CODOPE                   VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  NUMCLIALOPA              VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  ESTADO                  DOM_BOOL ,
  FECHA_DESCO            TIMESTAMP,
  NUMINTER                 INTEGER,
  GESTIONADO               VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  GESTIONO                 VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  INTE                     VARCHAR(    15) CHARACTER SET NONE NOT NULL COLLATE NONE,
 CONSTRAINT PK1_LOTE_DESC_RACSA PRIMARY KEY (ESTADO, INTE)
)
;

CREATE TABLE LOTE_RECO_RACSA
(
  ORDRE                     INTEGER         NOT NULL,
  FECHA_CARGA             TIMESTAMP,
  CODOPE                    VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  NUMCLIALOPA               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  ESTADO                   DOM_BOOL ,
  NUMINTER                  INTEGER,
  INTE                      VARCHAR(    15) CHARACTER SET NONE NOT NULL COLLATE NONE,
  ESTADO_ORDEN              VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  FECHA_RECO              TIMESTAMP,
 CONSTRAINT PK1_LOTE_RECO PRIMARY KEY (ESTADO, INTE)
)
;

CREATE TABLE MATERIAL
(
  CODMAT                        CHAR(     9) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NOM                        LIBELLE ,
  TIPOMAT                       CODE ,
  PRIX                         PRICE ,
  ORDEN_REPORTE              INTEGER,
  ACTIVO                    DOM_BOOL ,
 CONSTRAINT MATERIALPRIMARYKEY1 PRIMARY KEY (CODMAT)
)
;

CREATE TABLE MATRIZ_MAX_SERVICIOS
(
  CODPROD                 CODE NOT NULL,
  MAXIMO               INTEGER         NOT NULL,
 CONSTRAINT MATRIZ_MAX_SERVICIOSPRIMARYKEY1 PRIMARY KEY (CODPROD)
)
;

CREATE TABLE MATRIZ_NO_COMBINA
(
  CODPROD                          CODE NOT NULL,
  CODPROD_NO_COMBO                 CODE NOT NULL,
 CONSTRAINT MATRIZ_NO_COMBINAPRIMARYKEY1 PRIMARY KEY (CODPROD, CODPROD_NO_COMBO)
)
;

CREATE TABLE MATRIZ_OPCIONES
(
  NUM_OPCION                  CHAR(     1) CHARACTER SET NONE NOT NULL COLLATE NONE,
  DESC_OPCION              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT MATRIZ_OPCIONESPRIMARYKEY1 PRIMARY KEY (NUM_OPCION)
)
;

CREATE TABLE MATRIZ_REGLAS
(
  LN                          SMALLINT         NOT NULL,
  MAXSERVICIOS                DOM_BOOL ,
  NOCOMBINA                   DOM_BOOL ,
  SERVOBLIGATORIO             DOM_BOOL ,
  DEBECOMBINAR                DOM_BOOL ,
 CONSTRAINT MATRIZ_REGLASPRIMARYKEY1 PRIMARY KEY (LN)
)
;

CREATE TABLE MATRIZ_REGLAS_OT
(
  NUM_OPCION                 CHAR(     1) CHARACTER SET NONE NOT NULL COLLATE NONE,
  LINEA                   INTEGER         NOT NULL,
  TIPO                       CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  GRUPOLATE                  CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT MATRIZ_REGLAS_OTPRIMARYKEY1 PRIMARY KEY (NUM_OPCION, LINEA)
)
;

CREATE TABLE MATRIZ_SERV_OBLIGATORIO
(
  CODPROD                 CODE NOT NULL,
 CONSTRAINT SERV_OBLIGATORIOPRIMARYKEY1 PRIMARY KEY (CODPROD)
)
;

CREATE TABLE MATRIZ_SI_COMBINA
(
  CODPROD                          CODE NOT NULL,
  CODPROD_SI_COMBO                 CODE NOT NULL,
 CONSTRAINT MATRIZ_SI_COMBINAPRIMARYKEY1 PRIMARY KEY (CODPROD, CODPROD_SI_COMBO)
)
;

CREATE TABLE MOORE
(
  NUMABONNE                   NUMABONNE NOT NULL,
  NUMSOUSCRIPT                NUMABONNE ,
  NOM                           VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  ADRESSE                       VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  PERIODE                          MOIS ,
  DT                                DAT ,
  TITULOSALDO                   VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  SOLDMESANTES                    PRICE ,
  CODPROD0                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO0                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT0                         INTEGER,
  SERVMTT0                        PRICE ,
  SERVMTTDOL0                     PRICE ,
  SERVMTT0G                       PRICE ,
  CODPROD1                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO1                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT1                         INTEGER,
  SERVMTT1                        PRICE ,
  SERVMTTDOL1                     PRICE ,
  SERVMTT1G                       PRICE ,
  CODPROD2                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO2                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT2                         INTEGER,
  SERVMTT2                        PRICE ,
  SERVMTTDOL2                     PRICE ,
  SERVMTT2G                       PRICE ,
  CODPROD3                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO3                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT3                         INTEGER,
  SERVMTT3                        PRICE ,
  SERVMTTDOL3                     PRICE ,
  SERVMTT3G                       PRICE ,
  CODPROD4                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO4                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT4                         INTEGER,
  SERVMTT4                        PRICE ,
  SERVMTTDOL4                     PRICE ,
  SERVMTT4G                       PRICE ,
  CODPROD5                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO5                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT5                        PRICE ,
  CANT5                         INTEGER,
  SERVMTTDOL5                     PRICE ,
  SERVMTT5G                       PRICE ,
  CODPROD6                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO6                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVMTT6                        PRICE ,
  SERVMTTDOL6                     PRICE ,
  SERVMTT6G                       PRICE ,
  CODPROD7                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO7                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT7                         INTEGER,
  SERVMTT7                        PRICE ,
  SERVMTTDOL7                     PRICE ,
  SERVMTT7G                       PRICE ,
  CODPROD8                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO8                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT8                         INTEGER,
  SERVMTT8                        PRICE ,
  SERVMTTDOL8                     PRICE ,
  SERVMTT8G                       PRICE ,
  CODPROD9                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO9                     VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT9                         INTEGER,
  SERVMTT9                        PRICE ,
  SERVMTTDOL9                     PRICE ,
  SERVMTT9G                       PRICE ,
  CODPROD10                        CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO10                    VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT10                        INTEGER,
  SERVMTT10                       PRICE ,
  SERVMTTDOL10                    PRICE ,
  SERVMTT10G                      PRICE ,
  CODPROD11                        CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO11                    VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CANT11                        INTEGER,
  SERVMTT11                       PRICE ,
  SERVMTTDOL11                    PRICE ,
  SERVMTT11G                      PRICE ,
  NUEVOSALDO                      PRICE ,
  RUTA                          NBPRISE ,
  TELDOM                        VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  NOMBRECBOR                    VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERV0                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT0                            PRICE ,
  MTT0G                           PRICE ,
  SERV1                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT1                            PRICE ,
  MTT1G                           PRICE ,
  SERV2                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT2                            PRICE ,
  MTT2G                           PRICE ,
  SERV3                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT3                            PRICE ,
  MTT3G                           PRICE ,
  SERV4                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT4                            PRICE ,
  MTT4G                           PRICE ,
  SERV5                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT5                            PRICE ,
  MTT5G                           PRICE ,
  SERV6                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT6                            PRICE ,
  MTT6G                           PRICE ,
  SERV7                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT7                            PRICE ,
  MTT7G                           PRICE ,
  SERV8                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT8                            PRICE ,
  MTT8G                           PRICE ,
  SERV9                         VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT9                            PRICE ,
  MTT9G                           PRICE ,
  SERV10                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT10                           PRICE ,
  MTT10G                          PRICE ,
  SERV11                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT11                           PRICE ,
  MTT11G                          PRICE ,
  TVAPROD                         PRICE ,
  TOTALAPAGAR                     PRICE ,
  CBOR                             CODE ,
  PAGODESPUES                     PRICE ,
  NOMBREPAGADOR                 VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  DESDEHASTA                    VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  ULTIMOPAGO                        DAT ,
  COLONMESACTUAL                  PRICE ,
  COLONMESANTERIOR                PRICE ,
  FECHASPAGOS                      CHAR(    36) CHARACTER SET NONE  COLLATE NONE,
  FACTURA                       INTEGER,
  COMMENT1                         CHAR(    60) CHARACTER SET NONE  COLLATE NONE,
  COMMENT2                         CHAR(    60) CHARACTER SET NONE  COLLATE NONE,
  LOCALIZATION                    INSEE ,
  CAMBIODIR                    DOM_BOOL ,
  NUMTAP                        VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  CODINSEE                      JOURNAL ,
 CONSTRAINT MOOREPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE MOTIF
(
  CODMOTIF                 CODE NOT NULL,
  LIB                   LIBELLE ,
  CODPROD                  CODE ,
  TIPO                     CHAR(     2) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT MOTIFPRIMARYKEY1 PRIMARY KEY (CODMOTIF)
)
;

CREATE TABLE NODE
(
  NUMNODE                       LIBCOURT NOT NULL,
  LIB                            LIBELLE ,
  NBREABONNE                   NUMABONNE ,
  DOBLEVIA                          BOOL ,
  ACTIVO                         VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  CODIFICADO                    DOM_BOOL ,
  CLASE                             CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  FECHA_INIC                   TIMESTAMP,
  FECHA_FINC                   TIMESTAMP,
  CANTCABLE                      INTEGER,
  STRAND                         INTEGER,
  CAPACIDAD                      INTEGER,
  KMXNODO                        INTEGER,
  COMENTARIO                     VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  COD_ENLACE                     VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  DESCRIP_ENLACE                 VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
  FECHA_ENLACE                 TIMESTAMP,
  KM_ENLACE                      INTEGER,
  FIBRA_ENLACE                   INTEGER,
  COMENT_ENLACE                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  PUNTA_INI_ENLACE               INTEGER,
  PUNTA_FIN_ENLACE               INTEGER,
  CODIGO_HEADEND                 VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODIGO_HUB                     VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  PLAQUEADO                      VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  COMENTARIO_ESTADO              VARCHAR(   250) CHARACTER SET NONE  COLLATE NONE,
  ESTADO                         INTEGER         NOT NULL,
 PRIMARY KEY (NUMNODE, CODIGO_HEADEND, CODIGO_HUB)
)
;

CREATE TABLE NODETAP
(
  NUMNODE             LIBCOURT NOT NULL,
  TAPINI               VARCHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
  TAPFIN               VARCHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
 CONSTRAINT NODETAPPRIMARYKEY1 PRIMARY KEY (TAPINI, TAPFIN)
)
;

CREATE TABLE PAGOS_EN_LINEA
(
  NUMPIECE                 INTEGER         NOT NULL,
  NUMABONNE                INTEGER         NOT NULL,
  CODIGO_PAGO              INTEGER         NOT NULL,
  RECAUDADOR               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MONTO                      PRICE ,
  FECHA_PAGO             TIMESTAMP         NOT NULL,
 CONSTRAINT PK1_PAGOS_EN_LINEA PRIMARY KEY (CODIGO_PAGO)
)
;

CREATE TABLE PAGOS_EN_LINEA2
(
  NUMPIECE                 INTEGER         NOT NULL,
  NUMABONNE                INTEGER         NOT NULL,
  CODIGO_PAGO              INTEGER         NOT NULL,
  RECAUDADOR               VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MONTO                      PRICE ,
  TIPO                     VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  FECHA_PAGO             TIMESTAMP         NOT NULL,
 CONSTRAINT PK1_PAGOS_EN_LINEA2 PRIMARY KEY (CODIGO_PAGO)
)
;

CREATE TABLE PAISES
(
  CPAIS              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NPAIS              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  TIPO                  CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 PRIMARY KEY (CPAIS)
)
;

CREATE TABLE PANNE
(
  CODPANNE                 CODE NOT NULL,
  LIB                   LIBELLE ,
  CODPROD                  CODE ,
 CONSTRAINT PANNEPRIMARYKEY1 PRIMARY KEY (CODPANNE)
)
;

CREATE TABLE PARAM_COMPA
(
  COD_PARAM_COMPA              INTEGER         NOT NULL,
  DESCRICION                      BLOB SUB_TYPE 0 SEGMENT SIZE 80,
  ESTADO                          BLOB SUB_TYPE 0 SEGMENT SIZE 80,
 CONSTRAINT PK_PARAM_COMPA PRIMARY KEY (COD_PARAM_COMPA)
)
;

CREATE TABLE PARAMETRE
(
  CODTBL                     CODE NOT NULL,
  CODE                       CODE NOT NULL,
  LIBCODE                 LIBELLE ,
  INFO_REQUE              VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PARAMETREPRIMARYKEY1 PRIMARY KEY (CODTBL, CODE)
)
;

CREATE TABLE PAYEUR
(
  NUMABONNE            NUMABONNE NOT NULL,
  GENRE                     SEXE ,
  NOM                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  ADRESSE                VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  COMMUNE                VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  TEL                    VARCHAR(    14) CHARACTER SET NONE  COLLATE NONE,
  BANQUE                 VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  TYPCB                     CODE ,
  DTEXPIR                  INSEE ,
  ZONE                     INSEE ,
  CODCB                  VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  NUMID                NUMABONNE ,
  DTCBDEBUT                  DAT ,
  DTCBFIN                    DAT ,
  CPROV                  VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CCANTON                VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CDISTRI                VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PAYEURPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE PBSERV
(
  ORDRE            NUMABONNE NOT NULL
)
;

CREATE TABLE PPVCLASE
(
  CODE                    CODE NOT NULL,
  LIBCODE              VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PPVCLASEPRIMARYKEY1 PRIMARY KEY (CODE)
)
;

CREATE TABLE PPVRATING
(
  CODE                    CODE NOT NULL,
  LIBCODE              VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PPVRATINGPRIMARYKEY1 PRIMARY KEY (CODE)
)
;

CREATE TABLE PPVTIPO
(
  CODE                    CODE NOT NULL,
  LIBCODE              VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PPVTIPOPRIMARYKEY1 PRIMARY KEY (CODE)
)
;

CREATE TABLE PRISE
(
  NUMABONNE                 NUMABONNE NOT NULL,
  CODINT                         CODE ,
  NUMPLB                           PB ,
  DTRACC                          DAT ,
  DTCOUPE                         DAT ,
  COMMENT                     VARCHAR(   100) CHARACTER SET NONE  COLLATE NONE,
  NUMTERM                     VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  NUMTERM2                    VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  NUMTAP                      VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE,
  SORTIETAP                  SMALLINT,
  ESTADO                         CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  PILOTO                     DOM_BOOL ,
  OPTICNODE2                  VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_RAMAL                VARCHAR(     3) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_TAP                  VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  OPTICNODE                  LIBCOURT ,
 CONSTRAINT PRISEPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE PROB
(
  NUMABONNE            NUMABONNE NOT NULL,
  SOLDEC                   PRICE ,
  SOLDDETEC                PRICE ,
 CONSTRAINT PROBPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE PRODUIT
(
  CODPROD                       CODE NOT NULL,
  NOM                        LIBELLE ,
  PRIX                         PRICE ,
  CODTVA                        CODE NOT NULL,
  JRNLVTE                    JOURNAL NOT NULL,
  JRNLBKE                    JOURNAL ,
  NATURE                        CODE ,
  TAX                          PRICE ,
  CPTNUM                        CHAR(    20),
  DTDEB                    TIMESTAMP,
  DTFIN                    TIMESTAMP,
  PRIXDOL                      PRICE ,
  PAGOMESES                 SMALLINT,
  CODINSEE                     INSEE ,
  CTMODIF                       CODE ,
  CTINST                        CODE ,
  PRORATEO                  DOM_BOOL ,
  FALTATERMINAL             DOM_BOOL ,
  FACMONTOFIJO              DOM_BOOL ,
  DOBLEVIA                  DOM_BOOL ,
  PERIODICIDAD              SMALLINT,
  FECHA_FIJA                DOM_BOOL ,
  PROMOCION                 DOM_BOOL ,
  TIPO                          CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  NUMAPS                     VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  ALOPA                      VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  PAQRACSA                      CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PRODUITPRIMARYKEY1 PRIMARY KEY (CODPROD)
)
;

CREATE TABLE PROPSERV
(
  ORDRE                   NUMABONNE NOT NULL,
  ANCHOBANDA                   CODE ,
  MEDIOTRANS                   CODE ,
  METODTRANS                   CODE ,
  EXCLUSIVIDAD             DOM_BOOL
)
;

CREATE TABLE PROVINCIAS
(
  CPROV              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NPROV              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  CPAIS              VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
 PRIMARY KEY (CPROV, CPAIS)
)
;

CREATE TABLE QUERIES
(
  CORRELATIVO              INTEGER         NOT NULL,
  COMANDO                  VARCHAR(  4096) CHARACTER SET NONE  COLLATE NONE,
  DESCRIPCION              VARCHAR(   255) CHARACTER SET NONE  COLLATE NONE,
  NOMBRE                   VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT QUERIESPRIMARYKEY1 PRIMARY KEY (CORRELATIVO)
)
;

CREATE TABLE RAMAL
(
  CODIGO_RAMAL                VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NOMBRE_RAMAL                VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMNODE                    LIBCOURT NOT NULL,
 PRIMARY KEY (CODIGO_RAMAL, CODIGO_HEADEND, CODIGO_HUB, NUMNODE)
)
;

CREATE TABLE RECHABONNE
(
  NUMID               NUMABONNE NOT NULL,
  ABONNE              NUMABONNE ,
  SOUSCRIT            NUMABONNE ,
  NOM                     LIBLG ,
  TEL                 TELEPHONE ,
  NUMCTRT             NUMABONNE ,
 CONSTRAINT RECHABONNEPRIMARYKEY1 PRIMARY KEY (NUMID)
)
;

CREATE TABLE RECIBO
(
  NUMRECU                        NUMABONNE NOT NULL,
  NUMABONNE                      NUMABONNE NOT NULL,
  PERIODE                             MOIS ,
  DT                                   DAT ,
  SERVICIO1                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO2                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO3                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO4                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO5                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO6                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT1                               PRICE ,
  MTT2                               PRICE ,
  MTT3                               PRICE ,
  MTT4                               PRICE ,
  MTT5                               PRICE ,
  MTT6                               PRICE ,
  MTT1G                              PRICE ,
  MTT2G                              PRICE ,
  MTT3G                              PRICE ,
  MTT4G                              PRICE ,
  MTT5G                              PRICE ,
  MTT6G                              PRICE ,
  MTTDOL1                            PRICE ,
  MTTDOL2                            PRICE ,
  MTTDOL3                            PRICE ,
  MTTDOL4                            PRICE ,
  MTTDOL5                            PRICE ,
  MTTDOL6                            PRICE ,
  NUEVOSALDO                         PRICE ,
  PAGODESPUES                        PRICE ,
  SOLDPREC                           PRICE ,
  STATUT                              BOOL ,
  CBOR                                CODE ,
  PAGOCOBRADOR                       PRICE ,
  PAGOCOBRADORDESPUES                PRICE ,
  SERVICIO7                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO8                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO9                        VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO10                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO11                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  SERVICIO12                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  MTT7                               PRICE ,
  MTT8                               PRICE ,
  MTT9                               PRICE ,
  MTT10                              PRICE ,
  MTT11                              PRICE ,
  MTT12                              PRICE ,
  MTT7G                              PRICE ,
  MTT8G                              PRICE ,
  MTT9G                              PRICE ,
  MTT10G                             PRICE ,
  MTT11G                             PRICE ,
  MTT12G                             PRICE ,
  MTTDOL7                            PRICE ,
  MTTDOL8                            PRICE ,
  MTTDOL9                            PRICE ,
  MTTDOL10                           PRICE ,
  MTTDOL11                           PRICE ,
  MTTDOL12                           PRICE ,
  COMMENT1                            CHAR(    60) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT RECIBOPRIMARYKEY1 PRIMARY KEY (NUMRECU)
)
;

CREATE TABLE RECU
(
  NUMRECU              NUMABONNE NOT NULL,
  NUMABONNE            NUMABONNE ,
  MDRGT                     CODE ,
  SOLDE                    PRICE ,
  PERIODE                   MOIS ,
  DTPAIE                     DAT ,
  CBOR                      CODE ,
  CPT                    INTEGER         NOT NULL,
  CODOPE                   LOGIN ,
  CODINSEE               JOURNAL ,
 CONSTRAINT RECUPRIMARYKEY1 PRIMARY KEY (CPT)
)
;

CREATE TABLE RECUPIMP
(
  NUMABONNE            NUMABONNE NOT NULL,
  MTT                      PRICE ,
  STATUT                    BOOL ,
  TIPOPAGO                  CHAR(     2) CHARACTER SET NONE  COLLATE NONE,
  NUMRECU                   CHAR(     8) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT RECUPIMPPRIMARYKEY1 PRIMARY KEY (NUMABONNE)
)
;

CREATE TABLE REPORTES
(
  CODIGO              INTEGER         NOT NULL,
  NOMBRE              VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE ROLES
(
  NUMROLE                NUMABONNE NOT NULL,
  NUMINTER               NUMABONNE ,
  TIPO                        CODE ,
  DTSAISIE                     DAT ,
  HRSAISIE                   HEURE ,
  OPESAISIE                  LOGIN ,
  FECHACITA                    DAT ,
  HRCITA                     HEURE ,
  OPEMODIF                   LOGIN ,
  FECHAMODIF                   DAT ,
  HRMODIF                    HEURE ,
  OBSERVACION              VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  STATUS                  DOM_BOOL ,
  CODINT                      CODE ,
  MOVIL                       CHAR(     6) CHARACTER SET NONE  COLLATE NONE,
  SECTOR                      CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  PADRINO                    LOGIN ,
 CONSTRAINT ROLESPRIMARYKEY1 PRIMARY KEY (NUMROLE)
)
;

CREATE TABLE SALDOS_PENDIENTES
(
  NUMABONNE                         INTEGER         NOT NULL,
  SALDO                               PRICE NOT NULL,
  FECHA                           TIMESTAMP         NOT NULL,
  ID_SALDOS_PENDIENTES              INTEGER         NOT NULL,
  ESTADO                            VARCHAR(     1) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMINTER                          INTEGER,
  NUMPIECE                          INTEGER,
 CONSTRAINT SALDOS_PENDIENTES_PK PRIMARY KEY (ID_SALDOS_PENDIENTES)
)
;

CREATE TABLE SCHEDULEPPV
(
  SCHEDID                   INTEGER         NOT NULL,
  LBEN                      INTEGER         NOT NULL,
  CHANNELID                SMALLINT,
  CHANNELNAME               VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
  SCHEDSTARTDT            TIMESTAMP,
  SCHEDSTARTTI                 CHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  SCHEDUREE                SMALLINT,
  DTSAISIE                TIMESTAMP,
  SCHEDBSID                 INTEGER,
 CONSTRAINT SCHEDULEPPVPRIMARYKEY1 PRIMARY KEY (SCHEDID)
)
;

CREATE TABLE SECTOR
(
  CODIGO                   INTEGER         NOT NULL,
  DESCRIPCION              VARCHAR(    30) CHARACTER SET NONE  COLLATE NONE,
  SECTOR                   VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT PK_SECTOR PRIMARY KEY (CODIGO)
)
;

CREATE TABLE SERVTERMINAL
(
  ORDRE               NUMABONNE NOT NULL,
  CODPROD                  CODE ,
  NUMSERIE                 CHAR(    15) CHARACTER SET NONE NOT NULL COLLATE NONE,
 CONSTRAINT SERVTERMINALPRIMARYKEY1 PRIMARY KEY (ORDRE)
)
;

CREATE TABLE SOCIETE
(
  NUMSOC                   NUMLOGIC NOT NULL,
  NOM                       LIBELLE ,
  NBABONNE                NUMABONNE ,
  AGENCE                    LIBELLE ,
  NUMRECU                 NUMABONNE ,
  TITULO1                   VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  TITULO2                   VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  TITULO3                   VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  TITULO4                   VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  OFICEID                   INTEGER,
  HEADEND                  SMALLINT,
  NOTELDLA                     CHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  REG_BANCOS               NUMLOGIC ,
  LABL_NIV01                VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  LABL_NIV02                VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  LABL_NIV03                VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  LABL_NIV04                VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  SOCIOCOLILLA             DOM_BOOL ,
 CONSTRAINT SOCIETEPRIMARYKEY1 PRIMARY KEY (NUMSOC)
)
;

CREATE TABLE SOLICITUD_CABIO_PRECIO
(
  ID                              INTEGER         NOT NULL,
  USUARIO_SOLICITA                   CHAR(    10) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODPROD                            CHAR(     4) CHARACTER SET NONE NOT NULL COLLATE NONE,
  FECHA_SOLICITUD               TIMESTAMP         NOT NULL,
  NOMBRE_SOLICITANTE              VARCHAR(    50) CHARACTER SET NONE NOT NULL COLLATE NONE,
  FEHA_APLICACION               TIMESTAMP,
  NOMBRE_APRUEBA                  VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  APROBADO                       DOM_BOOL ,
  USUARIO_APROBO                  VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  PRECIO_NUEVO                      PRICE ,
  USUARIO_APLICO                  VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  FECHA_APROBACION              TIMESTAMP,
  APLICADO                       DOM_BOOL ,
  TIPO_SOLICITUD                  INTEGER         NOT NULL,
  MONEDA                          INTEGER         NOT NULL,
  CODINSEE                          INSEE ,
  LOCALIZATION                      INSEE ,
 CONSTRAINT PK_SOLICITUD_CABIO_PRECIO PRIMARY KEY (ID)
)
;

CREATE TABLE STATRECO
(
  NUMSTATRECO            NUMABONNE NOT NULL,
  NUMABONNE              NUMABONNE NOT NULL,
  DTRECO                       DAT ,
  DTRESI                       DAT ,
 CONSTRAINT STATRECOPRIMARYKEY1 PRIMARY KEY (NUMSTATRECO)
)
;

CREATE TABLE TAP
(
  CODIGO_TAP                  INTEGER         NOT NULL,
  NOMBRE_TAP                  VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  CODIGO_HEADEND              VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CODIGO_HUB                  VARCHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMNODE                    LIBCOURT NOT NULL,
  CODIGO_RAMAL                VARCHAR(     3) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CAPACIDAD                   INTEGER,
  RANGO                       INTEGER,
  PUERTOS                     INTEGER,
  VALOR                       INTEGER,
  MARCA                       VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  INTELIGENTE                DOM_BOOL ,
 PRIMARY KEY (CODIGO_TAP, CODIGO_HEADEND, CODIGO_HUB, NUMNODE, CODIGO_RAMAL)
)
;

CREATE TABLE TAPXNODE
(
  NUMTAP                    CHAR(     9) CHARACTER SET NONE NOT NULL COLLATE NONE,
  NUMNODE                   CHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  RAMAL                     CHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
  CAPACIDAD             SMALLINT         NOT NULL,
 CONSTRAINT TAPXNODEPRIMARYKEY1 PRIMARY KEY (NUMTAP, NUMNODE)
)
;

CREATE TABLE TEMP
(
  NUMPIECE             NUMABONNE NOT NULL,
  NUMABONNE            NUMABONNE ,
  PERIODE                   MOIS ,
 CONSTRAINT TEMPPRIMARYKEY1 PRIMARY KEY (NUMPIECE)
)
;

CREATE TABLE TEMPCOMPARAINTERNET
(
  NUMABONNE                 NUMABONNE NOT NULL,
  SERVIDOR                    VARCHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  TIPOCABLEMODEM              VARCHAR(     6) CHARACTER SET NONE  COLLATE NONE,
  FECHA                     TIMESTAMP,
  USUARIO                     VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MSGERROR                    VARCHAR(   400) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE TEMPDETEC
(
  NUMTEMP             PIECECPT NOT NULL,
  CODPROD                 CODE NOT NULL,
  MTT                    PRICE ,
  CODTVA                  CODE ,
  NUMJRNL              JOURNAL ,
 CONSTRAINT TEMPDETECPRIMARYKEY1 PRIMARY KEY (NUMTEMP, CODPROD)
)
;

CREATE TABLE TEMPDETINTERMAT
(
  NUMINTER            NUMABONNE NOT NULL,
  CODMAT                   CHAR(     9) CHARACTER SET NONE NOT NULL COLLATE NONE,
  QTEINST              SMALLINT,
 CONSTRAINT TEMPDETINTERMATPRIMARYKEY1 PRIMARY KEY (NUMINTER, CODMAT)
)
;

CREATE TABLE TEMPEC
(
  NUMTEMP                     PIECECPT NOT NULL,
  NUMABONNE                  NUMABONNE ,
  PERIODE                         MOIS ,
  DTCPT                            DAT ,
  DTSAISIE                         DAT ,
  NUMJRNL                      JOURNAL ,
  LIB                          VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  NUMFACT                     PIECECPT ,
  MTTDEB                         PRICE ,
  MTTCRED                        PRICE ,
  MDRGLT                          CODE ,
  CODOPE                      LIBCOURT ,
  CODINSEE                       INSEE ,
  TYPEC                           CODE ,
  CBOR                            CODE ,
  RESUMANU                     INTEGER,
  NUMLOTE                      VARCHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  MOTIFIMP                        CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  LIBNC                        VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  NUMCHQ                      LIBCOURT ,
  BANKCHQ                      LIBELLE ,
  EMISOR                       VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  NUMCARD                      VARCHAR(    16) CHARACTER SET NONE  COLLATE NONE,
  NUMAUTORIZ                   VARCHAR(    16) CHARACTER SET NONE  COLLATE NONE,
  TARJETAHABIENTE              VARCHAR(    40) CHARACTER SET NONE  COLLATE NONE,
  MILLAS                         PRICE ,
  PAQUETE                         CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TEMPECPRIMARYKEY1 PRIMARY KEY (NUMTEMP)
)
;

CREATE TABLE TEMPFACTPPV
(
  NUMABONNE            NUMABONNE ,
  MONTO                    PRICE ,
  PELICULAS             SMALLINT
)
;

CREATE TABLE TEMPINTES
(
  CUENTARACSA              INTEGER,
  INTE                     VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  LOGIN                    VARCHAR(    25) CHARACTER SET NONE  COLLATE NONE,
  PAQUETE                     CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  NUMCONTRAT             NUMABONNE ,
  ORDRE                    INTEGER,
  MOVIM                       CHAR(     1) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE TEMPNODE
(
  LOCALIZATION                 CHAR(     5) CHARACTER SET NONE  COLLATE NONE,
  NUMNODO                   VARCHAR(     9) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE TEMPRACSAINTE
(
  NUMABONNE              NUMABONNE NOT NULL,
  CUENTARACSA              INTEGER,
  INTE                     VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  LOGIN                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  PAQRACSA                    CHAR(     4) CHARACTER SET NONE  COLLATE NONE,
  MSGERROR                 VARCHAR(   400) CHARACTER SET NONE  COLLATE NONE
)
;

CREATE TABLE TERMINAL
(
  NUMID                 NUMABONNE ,
  NUMSERIE                   CHAR(    15) CHARACTER SET NONE NOT NULL COLLATE NONE,
  MODELO                     CHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  TIPO                       CHAR(     2) CHARACTER SET NONE  COLLATE NONE,
  STATUS                     CHAR(    10) CHARACTER SET NONE  COLLATE NONE,
  PRECIO                    PRICE ,
  DTSAISIE                    DAT ,
  PPV                        BOOL ,
  DOBLEVIA                   BOOL ,
  VOLUME                     BOOL ,
  REMOTE                     BOOL ,
  IPPV                       BOOL ,
  FAVORITE                   BOOL ,
  BSID17                     BOOL ,
  BSID20                     BOOL ,
  BSID21                     BOOL ,
  BSID22                     BOOL ,
  CREDIT                 SMALLINT,
  BSID123                    BOOL ,
  FECHAVENCE            TIMESTAMP,
  NUME_PROMO             SMALLINT,
  NUME_PROVI             SMALLINT,
  HUB                        CHAR(     1) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TERMINALPRIMARYKEY1 PRIMARY KEY (NUMSERIE)
)
;

CREATE TABLE TERMINALBSID
(
  NUMSERIE              VARCHAR(    15) CHARACTER SET NONE NOT NULL COLLATE NONE,
  BSID                     CHAR(     5) CHARACTER SET NONE NOT NULL COLLATE NONE,
 CONSTRAINT TERMINALBSIDPRIMARYKEY1 PRIMARY KEY (NUMSERIE, BSID)
)
;

CREATE TABLE TITLEPPV
(
  LBEN                      INTEGER         NOT NULL,
  MOVIENAME                 VARCHAR(    80) CHARACTER SET NONE  COLLATE NONE,
  DUREE                    SMALLINT,
  RATING                   SMALLINT,
  TIPOEVENT                SMALLINT,
  DTSAISIE                TIMESTAMP,
  PRIX                        PRICE ,
  GENREEVENT               SMALLINT,
  MOVIENAMEDLA              VARCHAR(    80) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TITLEPPVPRIMARYKEY1 PRIMARY KEY (LBEN)
)
;

CREATE TABLE TRANSACDLA
(
  NUMTRANSACDLA            NUMABONNE NOT NULL,
  DTSAISIE                       DAT ,
  HEURETRANSAC                  CHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  ENVOITRANSAC               VARCHAR(   250) CHARACTER SET NONE  COLLATE NONE,
  OPETRANSAC                   LOGIN ,
  RECUTRANSAC                VARCHAR(   150) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TRANSACDLAPRIMARYKEY1 PRIMARY KEY (NUMTRANSACDLA)
)
;

CREATE TABLE TRANSACPPV
(
  NUMTRANSACDLA            NUMABONNE NOT NULL,
  DTSAISIE                       DAT ,
  HEURETRANSAC                  CHAR(     8) CHARACTER SET NONE  COLLATE NONE,
  OPETRANSAC                   LOGIN ,
  RECUTRANSAC                   CHAR(   250) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT TRANSACPPVPRIMARYKEY1 PRIMARY KEY (NUMTRANSACDLA)
)
;

CREATE TABLE TYPPARA
(
  CODTBL                 CODE NOT NULL,
  LIB                 LIBELLE ,
 CONSTRAINT TYPPARAPRIMARYKEY1 PRIMARY KEY (CODTBL)
)
;

CREATE TABLE TYPTVA
(
  CODTVA                  CODE NOT NULL,
  LIB                  LIBELLE ,
  TAUX                    TAUX ,
  DIVISOR                PRICE ,
 CONSTRAINT TYPTVAPRIMARYKEY1 PRIMARY KEY (CODTVA)
)
;

CREATE TABLE UTILISATEUR
(
  LOGIN                        LOGIN NOT NULL,
  PASSE                        LOGIN ,
  DROIT                         CODE ,
  LIB                          LIBLG ,
  DATE_PASSWORD                  DAT ,
  DATE_CIERRE                    DAT ,
  DATE_LOGIN                     DAT ,
  HEURE_LOGIN                  HEURE ,
  FECHASALIDA              TIMESTAMP,
  EMAIL                      VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
  WORKTO                        CODE ,
  PRIORIDAD                  INTEGER,
  CASILLERO                  VARCHAR(    20) CHARACTER SET NONE  COLLATE NONE,
  CAMBIA_RELOJ               VARCHAR(     1) CHARACTER SET NONE  COLLATE NONE,
  CLAVE_EMAIL                VARCHAR(    12) CHARACTER SET NONE  COLLATE NONE,
  ALOPA                     DOM_BOOL ,
 CONSTRAINT DROITPRIMARYKEY1 PRIMARY KEY (LOGIN)
)
;

CREATE TABLE VENTE
(
  ORDRE                 NUMABONNE NOT NULL,
  NUMABONNE             NUMABONNE NOT NULL,
  CODPROD                    CODE ,
  MTT                       PRICE ,
  CODVEND                    CODE ,
  CODPROV                    CODE ,
  DTSAISIE                    DAT ,
  DTSIGN                      DAT ,
  DTMENS                      DAT ,
  DTPAIE                      DAT ,
  DTRESI                      DAT ,
  CODRESI                    CODE ,
  DTCHGTTF                    DAT ,
  CTINST                    PRICE ,
  CTREDUC                   PRICE ,
  MTTDOL                    PRICE ,
  QTEDMD                 SMALLINT,
  QTEREA                 SMALLINT,
  STATUT                   STATUT ,
  CODMARK                    CODE ,
  FACTPRORAT             DOM_BOOL ,
  INTE                    VARCHAR(    15) CHARACTER SET NONE  COLLATE NONE,
  NUM_DOCU                INTEGER,
  DTRESI2               TIMESTAMP,
 CONSTRAINT VENTEPRIMARYKEY1 PRIMARY KEY (ORDRE)
)
;

CREATE TABLE VISITE
(
  NUMVISITE            NUMABONNE NOT NULL,
  NUMABONNE            NUMABONNE ,
  DTSAISIE                   DAT ,
  LIB                    VARCHAR(    50) CHARACTER SET NONE  COLLATE NONE,
 CONSTRAINT VISITEPRIMARYKEY1 PRIMARY KEY (NUMVISITE)
)
;

CREATE TABLE VTE
(
  NUMABONNE            NUMABONNE NOT NULL,
  CODPROD                   CODE NOT NULL,
  NOM                    LIBELLE ,
  MTT                      PRICE ,
  PAIE                     PRICE
)
;

/*******************************************************************************
 * Indices
 * -------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

CREATE ASC INDEX ABONNEINDEX1 ON ABONNE (NUMCONTRAT);

CREATE ASC INDEX ABONNEINDEX2 ON ABONNE (CBOR);

CREATE ASC INDEX ABONNEINDEX3 ON ABONNE (LOCALIZATION);

CREATE ASC INDEX ABONNEINDEX4 ON ABONNE (NOM);

CREATE ASC INDEX ABONNEPPVINDEX1 ON ABONNEPPV (NUMEVENT);

CREATE ASC INDEX ABONNEPPVINDEX2 ON ABONNEPPV (NUMABONNE);

CREATE DESC INDEX AGINDEX1 ON AG (SOLD5);

CREATE ASC INDEX AVERINTERNETINDEX1 ON AVERINTERNET (NUMLLAMADA);

CREATE ASC INDEX AVERINTERNETINDEX2 ON AVERINTERNET (NUMABONNE);

CREATE ASC INDEX AVERINTERNETINDEX3 ON AVERINTERNET (NUMOT);

CREATE ASC INDEX AVERINTERNETINDEX4 ON AVERINTERNET (NUMCASO);

CREATE ASC INDEX BLOCNOTEINDEX1 ON BLOCNOTE (NUMABONNE);

CREATE ASC INDEX BLOCNOTEINDEX2 ON BLOCNOTE (DTSAISIE);

CREATE ASC INDEX CAJAPRINCINDEX1 ON CAJAPRINC (DTCPT);

CREATE ASC INDEX CAJAPRINCINDEX2 ON CAJAPRINC (CODOPE);

CREATE ASC INDEX CDDTRCONDIINDEX1 ON CDDTRCONDI (FECHA);

CREATE ASC INDEX CDDTRCONDIINDEX2 ON CDDTRCONDI (TELEFONO);

CREATE ASC INDEX CDDTRCONDIINDEX3 ON CDDTRCONDI (NUMABONNE);

CREATE ASC INDEX CLOSINGINDEX1 ON CLOSING (DTCLOS);

CREATE ASC INDEX COMPARAINTERNETINDEX1 ON TEMPCOMPARAINTERNET (NUMABONNE);

CREATE ASC INDEX CONTRATINDEX1 ON CONTRAT (DTRESI);

CREATE ASC INDEX CONTRATINDEX2 ON CONTRAT (CODVDS);

CREATE ASC INDEX CORREOSINDEX1 ON CORREOS (NUMINTER);

CREATE ASC INDEX CORREOSINDEX2 ON CORREOS (ORDRE);

CREATE ASC INDEX DECOLUNESINDEX1 ON DECOLUNES (JOUR);

CREATE ASC INDEX DETECINDEX1 ON DETEC (NUMPIECE);

CREATE ASC INDEX DETECINDEX2 ON DETEC (CODPROD);

CREATE ASC INDEX DETINTERINDEX1 ON DETINTER (NUMINTER);

CREATE ASC INDEX DETINTERINDEX2 ON DETINTER (CODPROD);

CREATE ASC INDEX ECRITCPTINDEX1 ON ECRITCPT (DTSAISIE);

CREATE ASC INDEX ECRITCPTINDEX2 ON ECRITCPT (NUMABONNE);

CREATE ASC INDEX ECRITCPTINDEX3 ON ECRITCPT (RESUMANU);

CREATE ASC INDEX ECRITCPTINDEX4 ON ECRITCPT (PERIODE);

CREATE ASC INDEX ECRITCPTINDEX5 ON ECRITCPT (MOTIFIMP);

CREATE ASC INDEX HISTERMINALINDEX1 ON HISTERMINAL (NUMABONNE);

CREATE ASC INDEX HISTERMINALINDEX2 ON HISTERMINAL (NUMSERIE);

CREATE ASC INDEX IMPAYEINDEX1 ON IMPAYE (NUMABONNE);

CREATE ASC INDEX INTERVENTIONINDEX1 ON INTERVENTION (DTDEB);

CREATE ASC INDEX INTERVENTIONINDEX2 ON INTERVENTION (NUMABONNE);

CREATE ASC INDEX INTERVENTIONINDEX3 ON INTERVENTION (DTCLOS);

CREATE ASC INDEX INTERVENTIONINDEX5 ON INTERVENTION (DTFIN);

CREATE ASC INDEX INTERVENTIONINDEX6 ON INTERVENTION (DTOTAVERIA);

CREATE ASC INDEX INTERVENTIONINDEX7 ON INTERVENTION (DTEDTOR);

CREATE ASC INDEX IPSERVINDEX1 ON IPSERV (ORDRE);

CREATE ASC INDEX LOGINSINDEX1 ON LOGINS (ORDRE);

CREATE ASC INDEX MATRIZ_NO_COMBINAINDEX1 ON MATRIZ_NO_COMBINA (CODPROD);

CREATE ASC INDEX MATRIZ_REGLASINDEX1 ON MATRIZ_REGLAS (LN);

CREATE ASC INDEX MATRIZ_SI_COMBINAINDEX1 ON MATRIZ_SI_COMBINA (CODPROD);

CREATE ASC INDEX MOOREINDEX1 ON MOORE (FACTURA);

CREATE ASC INDEX MOOREINDEX2 ON MOORE (LOCALIZATION);

CREATE ASC INDEX MOTIFINDEX1 ON MOTIF (CODMOTIF);

CREATE ASC INDEX NOM ON RECHABONNE (NOM);

CREATE ASC INDEX NUMABONNE ON RECHABONNE (ABONNE);

CREATE ASC INDEX NUMCTRT ON RECHABONNE (NUMCTRT);

CREATE ASC INDEX NUMSOUSCRIT ON RECHABONNE (SOUSCRIT);

CREATE ASC INDEX OALIASNAME ON DICO (TYPEID, ALIASNAME);

CREATE UNIQUE ASC INDEX OBJID ON DICO (OBJID, "VERSION");

CREATE ASC INDEX ONAME ON DICO (TYPEID, "NAME");

CREATE ASC INDEX PAYEURINDEX1 ON PAYEUR (NOM);

CREATE ASC INDEX PRISEINDEX1 ON PRISE (DTRACC);

CREATE ASC INDEX PRODUITINDEX1 ON PRODUIT (DTFIN);

CREATE ASC INDEX PRODUITINDEX2 ON PRODUIT (NATURE);

CREATE ASC INDEX PROPSERVINDEX1 ON PROPSERV (ORDRE);

CREATE UNIQUE ASC INDEX RDB$PRIMARY52 ON MOORE (NUMABONNE);

CREATE ASC INDEX RECIBOINDEX1 ON RECIBO (NUMABONNE);

CREATE ASC INDEX RECUINDEX1 ON RECU (NUMABONNE);

CREATE ASC INDEX RECUPIMPINDEX1 ON RECUPIMP (NUMABONNE);

CREATE ASC INDEX RELDEST ON DICO (DESTOBJID, DESTVERSION, TYPEID, SRCOBJID, SRCVERSION);

CREATE ASC INDEX RELSRC ON DICO (SRCOBJID, SRCVERSION, TYPEID, DESTOBJID, DESTVERSION);

CREATE ASC INDEX ROLESINDEX1 ON ROLES (NUMINTER);

CREATE ASC INDEX SCHEDULEPPVINDEX1 ON SCHEDULEPPV (LBEN);

CREATE ASC INDEX SCHEDULEPPVINDEX2 ON SCHEDULEPPV (SCHEDBSID);

CREATE ASC INDEX SCHEDULEPPVINDEX4 ON SCHEDULEPPV (CHANNELID);

CREATE ASC INDEX SERVTERMINALINDEX1 ON SERVTERMINAL (NUMSERIE);

CREATE ASC INDEX TEL ON RECHABONNE (TEL);

CREATE ASC INDEX TEMPDETECINDEX1 ON TEMPDETEC (NUMTEMP, CODPROD);

CREATE ASC INDEX TEMPECINDEX1 ON TEMPEC (NUMABONNE);

CREATE ASC INDEX TEMPECINDEX2 ON TEMPEC (CODOPE);

CREATE ASC INDEX TEMPNODEINDEX1 ON TEMPNODE (LOCALIZATION);

CREATE ASC INDEX TEMPRACSAINTEINDEX1 ON TEMPRACSAINTE (NUMABONNE);

CREATE ASC INDEX TERMINALINDEX1 ON TERMINAL (NUMID);

CREATE ASC INDEX TYPEID ON DICO (TYPEID);

CREATE ASC INDEX VENTEINDEX1 ON VENTE (NUMABONNE);

CREATE ASC INDEX VENTEINDEX2 ON VENTE (CODPROD);

CREATE ASC INDEX VENTEINDEX3 ON VENTE (DTPAIE);

CREATE ASC INDEX VENTEINDEX4 ON VENTE (INTE);

CREATE ASC INDEX VISITEINDEX1 ON VISITE (NUMABONNE);

CREATE ASC INDEX VTEINDEX1 ON VTE (NUMABONNE, CODPROD);

/*******************************************************************************
 * Unique Constraints
 * ------------------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

/*******************************************************************************
 * Check Constraints
 * -----------------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

ALTER TABLE SOLICITUD_CABIO_PRECIO ADD CONSTRAINT C_SOLICITUD_CABIO_PRECIO
 CHECK (

moneda in (1,2)

);

ALTER TABLE PAGOS_EN_LINEA2 ADD CONSTRAINT CHECHKTIPO1
 CHECK (

TIPO IN ('R','P')

);

ALTER TABLE SOLICITUD_CABIO_PRECIO ADD CONSTRAINT CHK1
 CHECK (

TIPO_SOLICITUD  in(1,2,3)

);

ALTER TABLE PARAM_COMPA ADD CONSTRAINT CKC_ESTADO_PARAM_CO
 CHECK (

ESTADO is null or (ESTADO in ('V','F'))

);

/*******************************************************************************
 * Foreign Key Constraints
 * -----------------------
 * Extracted at 09/08/2005 04:01:06 p.m.
 ******************************************************************************/

ALTER TABLE PROVINCIAS ADD
  FOREIGN KEY (CPAIS) REFERENCES PAISES
  (CPAIS)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE CANTONES ADD
  FOREIGN KEY (CPAIS, CPROV) REFERENCES PROVINCIAS
  (CPAIS, CPROV)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE DISTRITOS ADD
  FOREIGN KEY (CPAIS, CPROV, CCANTON) REFERENCES CANTONES
  (CPAIS, CPROV, CCANTON)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE LOCALIZATION ADD
  FOREIGN KEY (CPAIS, CPROV, CCANTON, CDISTRI) REFERENCES DISTRITOS
  (CPAIS, CPROV, CCANTON, CDISTRI)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE LOCALIZATION ADD
  FOREIGN KEY (CODINSEE) REFERENCES COMMUNE
  (CODINSEE)
  ON DELETE NO ACTION
  ON UPDATE CASCADE
;

ALTER TABLE HUB ADD
  FOREIGN KEY (CODIGO_HEADEND) REFERENCES HEADEND
  (CODIGO_HEADEND)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE NODE ADD
  FOREIGN KEY (CODIGO_HEADEND, CODIGO_HUB) REFERENCES HUB
  (CODIGO_HEADEND, CODIGO_HUB)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE RAMAL ADD
  FOREIGN KEY (CODIGO_HEADEND, CODIGO_HUB, NUMNODE) REFERENCES NODE
  (CODIGO_HEADEND, CODIGO_HUB, NUMNODE)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE TAP ADD
  FOREIGN KEY (CODIGO_HEADEND, CODIGO_HUB, NUMNODE, CODIGO_RAMAL) REFERENCES RAMAL
  (CODIGO_HEADEND, CODIGO_HUB, NUMNODE, CODIGO_RAMAL)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE LOCALIZACION_NODO ADD
  FOREIGN KEY (CODIGO_HEADEND, CODIGO_HUB, NUMNODE) REFERENCES NODE
  (CODIGO_HEADEND, CODIGO_HUB, NUMNODE)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE LOCALIZACION_NODO ADD
  FOREIGN KEY (CODINSEE, LOCALISATION) REFERENCES LOCALIZATION
  (CODINSEE, LOCALISATION)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE PRISE ADD
  FOREIGN KEY (NUMABONNE) REFERENCES ABONNE
  (NUMABONNE)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE NODE ADD
  FOREIGN KEY (ESTADO) REFERENCES ESTADO_NODO
  (ESTADO)
  ON DELETE NO ACTION
  ON UPDATE CASCADE
;

ALTER TABLE BITACORA_NODOS ADD
  FOREIGN KEY (ESTADO) REFERENCES ESTADO_NODO
  (ESTADO)
  ON DELETE NO ACTION
  ON UPDATE CASCADE
;

ALTER TABLE BITACORA_NODOS ADD
  FOREIGN KEY (CODIGO_HEADEND, CODIGO_HUB, NUMNODE) REFERENCES NODE
  (CODIGO_HEADEND, CODIGO_HUB, NUMNODE)
  ON DELETE CASCADE
  ON UPDATE CASCADE
;

ALTER TABLE PARAMETRE ADD CONSTRAINT PARAMETREFOREIGNKEY1
  FOREIGN KEY (CODTBL) REFERENCES TYPPARA
  (CODTBL)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION
;

ALTER TABLE UTILISATEUR ADD CONSTRAINT UTILISATEURFOREIGNKEY1
  FOREIGN KEY (DROIT) REFERENCES DROITS
  (DROIT)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION
;

/*******************************************************************************
 * Views
 * -----
 * Extracted at 09/08/2005 04:01:07 p.m.
 ******************************************************************************/

CREATE VIEW AVERIASINDETINTER
(
 NUMINTER,
 NUMABONNE,
 DTDEB,
 TIPO,
 LIB,
 MOTIF,
 CODPROD,
 MOVIMIENTO
) AS
 select numinter, numabonne, dtdeb, tipo, lib, motif, '0000' as codprod, 'Add' as movimiento
   from intervention
    where
     estado = 'F' and intervention.tipo = 'Apl'

;

/*******************************************************************************
 * Triggers
 * --------
 * Extracted at 09/08/2005 04:01:07 p.m.
 ******************************************************************************/

/*******************************************************************************
 * Trigger DETALLE_SOLICITUD_CP_ID on table/view DETALLE_SOLICITUD_CP
 ******************************************************************************/

SET TERM ^^ ;
CREATE TRIGGER DETALLE_SOLICITUD_CP_ID FOR DETALLE_SOLICITUD_CP ACTIVE BEFORE INSERT POSITION 0 AS
begin
  if (new.ID_DETALLE is null)
  then new.ID_DETALLE = gen_id(DETALLE_SOLICITUD_CP_GEN, 1);
end
^^
SET TERM ; ^^

/*******************************************************************************
 * Roles
 * -----
 * Extracted at 09/08/2005 04:01:07 p.m.
 ******************************************************************************/
