When migrating from oracle 10g to 11g, I’ve a stored procedure with a syntax like:
select * from table1
union
select t,y from
(select * from table2)aliasQuery
where t=aliasQuery.t
The query works well with 10g but 11g returns an error that aliasQuery is not defined.
Maybe this syntax is no longer supported in 11g or there is some missing database configurations?
EDIT
The full query is:
select *
from table1
union
select t, y
from ( select *
from table2 ) aliasQuery
where ( select max(t)
from ( select t
from table3
where table3.t = aliasQuery.t)
)>10
Based upon the Ask Tom article “Is there some sort of nesting limit for correlated subqueries?” it would appear that correlated subquery aliases working more than one level down was a bug that was fixed. It would seem that your 10g database does not have the bug fix while your 11g does. I tried your query on my 10g database and it fails with the same error as on my 11g one:
ORA-00904: "ALIASQUERY"."T": invalid identifier.You’re going to have to change the query around a bit to get it working in 11g now.