Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query returning different results on same Oracle database on 2 different systems

577e7661-a556-416e-96b8-922d6ff61cc0Dec 29 2017 — edited Dec 29 2017

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2018
Added on Dec 29 2017
12 comments
1,261 views