Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

View with parameter , subquery does not see outer value

David BalažicJul 27 2011 — edited Jul 28 2011
Hi!

I am trying to convert an existing view (read only) to a parametrized one, as per method #1 described here: http://www.orafaq.com/node/1922

(the reason is that using it is cleaner that the context variable approach - no extra statement for setting the variable, just a WHERE condition in the query)

The problem is, the subquery can no see the outer value.
The simplest form that fails is this:
select aaa.foo_val, bbb.* from tab1 aaa , (select * from tab2 where aaa.foo_val = CS_USERS.foo_val) bbb;
                                                                    *
gives:

ERROR at line 1:
ORA-00904: "AAA"."FOO_VAL": invalid identifier
I found this where it states:
Oracle doesn't correlate the subqueries nested more than one level deep

But in my case it is not more than one level deep, so I am confused, why does it not work.

Maybe I am overlooking something obvious, it is past midnight here....


Regards,
David

Edited by: xerces8 on Jul 28, 2011 12:13 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2011
Added on Jul 27 2011
4 comments
1,073 views