simple SQL queries give different results: Why?

  • From: Michael Moore <michaeljmoore@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 8 Feb 2011 17:39:28 -0800

The only difference is the MAX function.

SQL> SELECT d1.dummy
  FROM DUAL d1
 WHERE NOT EXISTS
          (SELECT MAX(1)
             FROM DUAL d2
            WHERE d2.dummy = 'z')
no rows selected.

SQL> SELECT d1.dummy
  FROM DUAL d1
 WHERE NOT EXISTS
          (SELECT 1
             FROM DUAL d2
            WHERE d2.dummy = 'z')

DUMMY
-----
X
1 row selected.

Other related posts: