Re: IN/NOT IN Parsing

From: William Robertson <williamr2019_at_googlemail.com>
Date: Sun, 26 Oct 2008 15:59:53 -0700 (PDT)
Message-ID: <13d5b8ae-8894-425c-8f15-96c9f8ad62dc@l77g2000hse.googlegroups.com>


On Oct 24, 10:00 am, "Preston" <dontwant..._at_nowhere.invalid> wrote:
> I'd never noticed until today that Oracle doesn't check if columns used
> in an in/not in clause are valid. Is this common knowledge that I've
> somehow missed out on?
>
> Strikes me as being very dangerous as you could typo a column name &
> never know about it - at least not until your data was already screwed
> up.
>
> create table t1 (id1 number);
>
> create table t2 (id1 number, id2 number);
>
> insert into t1 values(1);
>
> insert into t2 values(1,1);
> insert into t2 values(1,2);
>
> commit;
>
> select * from t2
> where id2 in (select id2 from t1);

I don't see a bug. Where does it say you can't refer to columns from the main query within the subquery? In fact if you couldn't, there would be no correlated subqueries. Received on Sun Oct 26 2008 - 17:59:53 CDT

Original text of this message