Why does my oracle statement run differently on a windows database than linux?

核能气质少年 提交于 2019-12-23 03:12:31

问题


I don't know where to begin to debug this. Some developers have been writing some pl/sql code locally on their Windows machines that complete fine using Oracle 10.2.0.1.0 - 64bit. When it gets to production, which is Red Hat 5.3 and running 10.2.0.2.0, it gives me this error:

ORA-00904: "S"."BARSTREAMREFERENCEID": invalid identifier

Here is the gist of the code that is working in Windows:

EXECUTE IMMEDIATE('
  update candyman.CANDY_REFERENCES s
     set ( s.flavour, s.taste, s.colour, s.privateField3 ) =
         ( select * from
                ( select r.flavour, r.taste, r.colour, null
                    from candyman.FOO_REFERENCE_SET t
                    join candyman.FOO_REFERENCES r on r.fooReferenceID = t.fooReferenceID
                   where t.barStreamReferenceID = s.barStreamReferenceID
                order by r.colour )
            where rownum = 1 )
   where privateField3 is not null
     and exists
         ( select 1
             from candyman.FOO_REFERENCE_SET t
             join candyman.FOO_REFERENCES r on r.fooReferenceID = t.fooReferenceID
            where t.barStreamReferenceID = s.barStreamReferenceID )
');

I know... they should have updated their Oracle versions with the rest of the company and be developing on the same version as production, but it is too late and I can't control them...

Any ideas are greatly appreciated.


回答1:


See this AskTom thread:

ANSI SQL has table references (correlation names) scoped to just one level deep

...

In version 10.2.0.1.0 this query works:

select (select count(*) from (select * from scott.emp where ename = dual.dummy)) from dual;

...

that was a bug.

it works in none of the terminal releases of 9i, 10g, or 11g

I'm a huge fan of developing locally. One of the main benefits is that it's easier to configure and manage your local instance than a server. I'm surprised that a developer would not want to use a newer version.



来源:https://stackoverflow.com/questions/13748795/why-does-my-oracle-statement-run-differently-on-a-windows-database-than-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!