在oracle 11g和10g

时间:2015-11-16 09:00:52

标签: oracle oracle11g oracle10g

查询在oracle 10g和oracle 11g中没有给出相同的结果:

    with table1 as
 (select 1 as id, 'A' as col1, 'X' as col2
    from dual
  union all
  select 2 as id, 'Y' as col1, 'A' as col2
    from dual
  union all
  select 3 as id, 'Z' as col1, 'Z' as col2
    from dual)
select *
  from table1
 where (1 = 1 and (ID=2 or ID=3))
    or EXISTS (SELECT 0 FROM dual WHERE col1 = 'A')
    or EXISTS (SELECT 0 FROM dual WHERE col2 = 'A')

导致oracle 11g:

ID  COL1    COL2
1   A       X
2   Y       A

enter image description here 导致oracle 10g:

ID  COL1    COL2
1   A       X
2   Y       A
3   Z       Z

enter image description here 为什么???

0 个答案:

没有答案