3 Replies Latest reply: Jul 24, 2013 10:10 PM by Manik RSS

    Reg: similar query,different result-

    ranit B

      Hi Experts,

       

      I'm seeing a strange behavior in our production environment. The below 2 queries give different results:

      Query-1

      SELECT COUNT(*) FROM table_1

      WHERE NOT EXISTS (SELECT '1' FROM table_2 WHERE table_1.pk = table_2.pk);


      OUTPUT: 352

       

      Query-2

      SELECT COUNT(*) FROM table_1

      WHERE NOT EXISTS (SELECT 1 FROM table_2 WHERE table_1.pk = table_2.pk);


      OUTPUT: 0


      I tried creating dummy tables and check the same on my home 11.2 XE. It worked fine.

      Btw, I haven't checked the Oracle version or the execution plan yet (will go to office and check)... But any pointers why this could be happening?

      Can it be due to old statistics or histograms or any other factor?

       

      Any pointers?

       

      - Ranit