Franz Fortuny Guest
|
Posted: Tue May 15, 2007 9:33 pm Post subject: A query that works directly and within IDE but NOT when the |
|
|
This query:
select a.id,a.descri,a.existe-a.reser as dispo,
a.existe,a.reser,a.pventa,a.pventa2,
a.area,a.serial,a.idarea,a.cosba
from vwsubexi a where descri like :modelo and
(idarea=:idarea or idarea is null)
union all
select b.id,b.descri,b.existe-b.reser as dispo,
b.existe,b.reser,b.pventa,b.pventa2,
b.area,b.serial,b.idarea,b.cosba
from subartis su
join tor_equiv te on te.idsub1=su.idsubarti and su.descri like :modelo
join vwsubexi b on b.id=te.idsub2 and b.existe > 0
will produce correct results when executed directly (via ibexpert) or
when tested within the IDE.
But when the query is executed with the running program, it generates
the following result:
Dynamic SQL Error
SQL error code = -804
Incorrect values within SQLDA structure.
Why does this happen? It definitely has to do with either the way the
running program is sending the query or the way it is receiving it.
I suspect it has to do with receiving it rather than sending it, because
the Prepare() instruction does run correctly during runtime.
I must add that my workaround was to hide the offending query within a
PROCEDURE and execute the procedure from the program. Then the results
were what I needed. However, I don't see why this sort of thing has to
happen...
Any light upon this darkness will be greatly appreciated.
F J Fortu |
|