BrianTyler
IS-IT--Management
I have a query which normally runs OK against a v8.1 UDB database, but gives wrong results when I run it against a federated database, though it points to the same physical tables.
The problem is almost certainly due to a CASE statement which contains a sub-query:
select
col_a,
case when exists
(select col_b from tabb where
tabb.col_b = col_a
and tabb.col_x in (1,2)) then 'ABC'
else 'XYZ'
end
from taba
Running against the base database, the correct rows are returned (i.e. XYZ is returned for som instances).
Running against a federated database, where taba and tabb are in the remote database, the actual SQL that is run appears to do an inner join between the tables, thus not returning any rows with XYZ.
Does this ring a bell with anyone?
Thanks
Brian
The problem is almost certainly due to a CASE statement which contains a sub-query:
select
col_a,
case when exists
(select col_b from tabb where
tabb.col_b = col_a
and tabb.col_x in (1,2)) then 'ABC'
else 'XYZ'
end
from taba
Running against the base database, the correct rows are returned (i.e. XYZ is returned for som instances).
Running against a federated database, where taba and tabb are in the remote database, the actual SQL that is run appears to do an inner join between the tables, thus not returning any rows with XYZ.
Does this ring a bell with anyone?
Thanks
Brian