I have a 2 identical databases running on Oracle 12c. They are sitting on 2 different servers.
I'm executing the following query using SQL Developer on both databases.
select *
from sla
where objectname = 'INCIDENT' and
status in 'ACTIVE' and
(exists (select 1
from classancestor
where ancestor=sla.classstructureid and classancestor.classstructureid= '') or
classstructureid is null or
classstructureid = ''
) ;
I get 260 results on one of the databases and 0 results on the other. This query is generated by an ERP we are using so I cannot modify the SQL itself.
One thing I noticed is that if I remove the parentheses surrounding the exists operator, the behaviour changes.
Can someone help? Is there a precedence when using OR? Is there an Oracle patch that has an impact on how SQL statements are processed?
Thanks
the behaviour changes... how does the behavior change? My guess is that the underlying tables are not the same.WHEREclause? I am assuming there is some funky precedence stuff going on here, but if you write your query right, that shouldn't matter on any version or Oracle.