Subject | Can't create VIEW |
---|---|
Author | dr_bentonquest |
Post date | 2004-02-06T20:57:17Z |
Hi there,
I'm trying to create the following VIEW, the SQL statement is composed
of two UNIONED (and almost identical) multiple-table joins:
CREATE VIEW HISTORIAL
(FECHA,HORA,TRACTOR,CAROVAC,DESCRIP,NOMBRE,CONTROL,DESCRIP,NOMCORTO,NOMBRE,NOMBRE,OPERFORAN,OBSERVA,STATUS)
AS
SELECT A.FECHA
, A.HORA
, A.TRACTOR
, A.CAROVAC
, B.DESCRIP
, C.NOMBRE
, A.CONTROL
, F.DESCRIP
, G.NOMCORTO
, H.NOMBRE
, I.NOMBRE
, A.OPERFORAN
, A.OBSERVA
, A.STATUS
FROM TRACKING A
JOIN TIPOREMOLQ B ON (B.NUMERO=A.TIPOREM)
JOIN CIASINTER C ON (C.NUMERO=A.COMPANIA)
JOIN STATUS F ON (F.NUMERO=A.STATUS)
JOIN CLIENTES G ON (G.NUMERO=A.CLIENTE)
JOIN AGENTES H ON (H.NUMERO=A.AGENTE)
JOIN OPERADORES I ON (I.NUMERO=A.OPERADOR)
UNION
SELECT A.FECHA
, A.HORA
, A.TRACTOR
, A.CAROVAC
, B.DESCRIP
, C.NOMBRE
, A.CONTROL
, F.DESCRIP
, G.NOMCORTO
, H.NOMBRE
, I.NOMBRE
, A.OPERFORAN
, A.OBSERVA
, A.STATUS
FROM HISTORICO A
JOIN TIPOREMOLQ B ON (B.NUMERO=A.TIPOREM)
JOIN CIASINTER C ON (C.NUMERO=A.COMPANIA)
JOIN STATUS F ON (F.NUMERO=A.STATUS)
JOIN CLIENTES G ON (G.NUMERO=A.CLIENTE)
JOIN AGENTES H ON (H.NUMERO=A.AGENTE)
JOIN OPERADORES I ON (I.NUMERO=A.OPERADOR)
The error I get is this:
This operation is not defined for system tables.
unsuccessful metadata update.
STORE RDB$RELATION_FIELDS failed.
attempt to store duplicate value (visible to active transactions) in
unique index "RDB$INDEX_15".
However, the SQL statement by itself (without the CREATE VIEW header)
gets executed correctly. There isn't any other VIEW with the same name.
What am I missing?
Thanks for your help,
-Benton
Using FB 1.0 for Linux.
I'm trying to create the following VIEW, the SQL statement is composed
of two UNIONED (and almost identical) multiple-table joins:
CREATE VIEW HISTORIAL
(FECHA,HORA,TRACTOR,CAROVAC,DESCRIP,NOMBRE,CONTROL,DESCRIP,NOMCORTO,NOMBRE,NOMBRE,OPERFORAN,OBSERVA,STATUS)
AS
SELECT A.FECHA
, A.HORA
, A.TRACTOR
, A.CAROVAC
, B.DESCRIP
, C.NOMBRE
, A.CONTROL
, F.DESCRIP
, G.NOMCORTO
, H.NOMBRE
, I.NOMBRE
, A.OPERFORAN
, A.OBSERVA
, A.STATUS
FROM TRACKING A
JOIN TIPOREMOLQ B ON (B.NUMERO=A.TIPOREM)
JOIN CIASINTER C ON (C.NUMERO=A.COMPANIA)
JOIN STATUS F ON (F.NUMERO=A.STATUS)
JOIN CLIENTES G ON (G.NUMERO=A.CLIENTE)
JOIN AGENTES H ON (H.NUMERO=A.AGENTE)
JOIN OPERADORES I ON (I.NUMERO=A.OPERADOR)
UNION
SELECT A.FECHA
, A.HORA
, A.TRACTOR
, A.CAROVAC
, B.DESCRIP
, C.NOMBRE
, A.CONTROL
, F.DESCRIP
, G.NOMCORTO
, H.NOMBRE
, I.NOMBRE
, A.OPERFORAN
, A.OBSERVA
, A.STATUS
FROM HISTORICO A
JOIN TIPOREMOLQ B ON (B.NUMERO=A.TIPOREM)
JOIN CIASINTER C ON (C.NUMERO=A.COMPANIA)
JOIN STATUS F ON (F.NUMERO=A.STATUS)
JOIN CLIENTES G ON (G.NUMERO=A.CLIENTE)
JOIN AGENTES H ON (H.NUMERO=A.AGENTE)
JOIN OPERADORES I ON (I.NUMERO=A.OPERADOR)
The error I get is this:
This operation is not defined for system tables.
unsuccessful metadata update.
STORE RDB$RELATION_FIELDS failed.
attempt to store duplicate value (visible to active transactions) in
unique index "RDB$INDEX_15".
However, the SQL statement by itself (without the CREATE VIEW header)
gets executed correctly. There isn't any other VIEW with the same name.
What am I missing?
Thanks for your help,
-Benton
Using FB 1.0 for Linux.