Faulty insert results in TUniQuery
Posted: Fri 20 Aug 2010 07:59
I am working with Unidac components on an Oracle 10.2 database. I am executing the following SQL query from à TUniQuery component :
But it seems to ignore the DISTINCT statement and tries to insert in the target tables the duplicate records found in source table, so breaking an unicity constraint.
Note that :
1/ when I execute this query directly in SQL Developer, all works fine,
2/ if I encapsulate the query in a stored procedure, it also works fine in SQL Developer, fot faulty in a TUniStoredProc component,
3/ The SELECT DISTINCT statement executed alone (without INSERT) returns correct results even in TUniQuery.
Has anyone got any explanation for that strange behaviour ?
Thank you very much by advance.
Roland
Code: Select all
INSERT INTO ROL_DEBITEUR (ID_PERSONNE, DEBITEUR_NOM, DEBITEUR_COMPLEMENT, NOM, PRENOM)
(SELECT DISTINCT ID_PERSONNE, DEBITEUR_NOM, DEBITEUR_COMPLEMENT, NOM, PRENOM
FROM ROL_TEMP
WHERE A_TRANSMETTRE = 1
AND ID_PERSONNE NOT IN (SELECT ID_PERSONNE FROM ROL_DEBITEUR));
Note that :
1/ when I execute this query directly in SQL Developer, all works fine,
2/ if I encapsulate the query in a stored procedure, it also works fine in SQL Developer, fot faulty in a TUniStoredProc component,
3/ The SELECT DISTINCT statement executed alone (without INSERT) returns correct results even in TUniQuery.
Has anyone got any explanation for that strange behaviour ?
Thank you very much by advance.
Roland