Subject Store Duplicate Value (Visible to Active Transactions) ????
Author Kurt Schneider
Hello
Sorry my bad english.

I Have a serious problem in my FB database. Actually i'm using FB 1.5 and
Delphi 7 and ODBCJDBC Driver.
Tomorrow, and client with some one machine is comming to support and related
have the erros in database:
STORE RDB$RELATION_FIELDS faied
attempt to store duplicate value (visible to active transactions) in unique
index "RDB$INDEX_15"

Well, i have other 20 clients, with more data moviment and not apresent same
problem, for the time being. ;-)
I look for solutions or idea of the Problem and for this have any
possiblite:
1) Energy oscilation;???
2) I Have a Store procedure and she DROP and CREATE and table (Temporary
Fisic Table), not a VIEW. I'm execute this procedure from Delphi with:
Step
1) BeginTransaction
2) Execute Procedure
3) Commit Transaction
After that other procedure adding data to Create Table. Whel... its
possible when create a table without none index ou primary Key ocured error
?
3) Its possible and procedure to only execute a part: Exemple: Drop and not
Create, and so block a transaction?

So, for finalization, i must extract all data and structure and recreate a
database, for use this again.

Any idea? It,s not normal....

In Attach and txt file with the 2 SP.

--
************************************************************************************
Kurt Schneider - [ Analista de Sistema ]
Especialista em Analise e Desenvolvimento de Software
ControlSoft - Assessoria e Desenvolvimento de Sistemas
e-mail: kjundia@...
"Quis custodiet ipsos custodes?" - SatirĂ¡s - De Juvenal

----------

/*
This SP Test when a Table TBT Exists and DROP.
After, Create a TBT again.
*/
CREATE PROCEDURE SP_PREPARASALDOES_TABELAS
AS
DECLARE VARIABLE VTEMTABELA INTEGER;
begin

VTEMTABELA = 0;
SELECT COALESCE(COUNT(RDB$RELATIONS.RDB$RELATION_NAME),0)
FROM RDB$RELATIONS
WHERE RDB$RELATIONS.RDB$RELATION_NAME = 'TBT_ESPRODUTO'
INTO :VTEMTABELA;
IF (:VTEMTABELA > 0) THEN
EXECUTE STATEMENT 'DROP TABLE TBT_ESPRODUTO';


EXECUTE STATEMENT 'CREATE TABLE TBT_ESPRODUTO(CODIGOEMPRESA INTEIRO,
CODIGOCLIENTE INTEIRO,
CODIGOSAFRA INTEIRO,
CODIGOPRODUTO INTEIRO,
CODIGOCFOP INTEIRO,
CODIGOOPERCFOP INTEIRO,
CODIGOOPERCOMPCFOP INTEIRO,
VCODIGOMOV INTEIRO,
CODIGOOPERESTOQUE CHAR_1,
VCODIGOMOVORIGEM INTEGER,
VCODIGOMOVDESTINO INTEGER,
VQUANT NUMERIC18_3)';
end


-----------------------------------------------------------------------------------------------------------------------------

/*
Select data from a VIEW and Insert into TBT
*/
CREATE PROCEDURE SP_PREPARASALDOES_DADOS (
PCODIGOEMPRESA INTEGER)
AS
DECLARE VARIABLE VSQL VARCHAR(30000);
begin
VSQL = '';
VSQL = 'INSERT INTO TBT_ESPRODUTO (CODIGOEMPRESA,
CODIGOCLIENTE,
CODIGOSAFRA,
CODIGOPRODUTO,
CODIGOCFOP,
CODIGOOPERCFOP,
CODIGOOPERCOMPCFOP,
VCODIGOMOV,
CODIGOOPERESTOQUE,
VCODIGOMOVORIGEM,
VCODIGOMOVDESTINO,
VQUANT) SELECT * FROM VW_ESPRODUTO
WHERE CODIGOEMPRESA = ' || :PCODIGOEMPRESA || ';';
EXECUTE STATEMENT VSQL;

end


[Non-text portions of this message have been removed]