Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: mistake, error, or something else ?

Re: mistake, error, or something else ?

From: Rob Cowell <rjc4687_at_hotmail.com>
Date: Mon, 27 Oct 2003 14:36:42 +0000 (UTC)
Message-ID: <3F9D2D7A.4AE1C6DA@hotmail.com>

Mike wrote:
>
> On Mon, 27 Oct 2003 14:26:26 +0000 (UTC), Rob Cowell
> <rjc4687_at_hotmail.com> wrote:
>
> >But it is 'sucessful'. Well it won't retrieve anything, but it's valid
> >syntax.
> >
> >(select distinct c from t2)
> >
> >in this sub query is the same as
> >
> >(select distinct t1.c from t2)
> >
> >and that's legal, but fairly useless code.
>
> i've understand, but it's not much logical
>
> can you explain me why parser consider the column named in subquery
> like a column owned by t1 and not by t2 ?
>
> Tia
>
> Mike

Because a sub query can reference columns from tables in the main query. The parser would consider the column if it existed in t2. But it knows column c doesn't exist in t2, so assumes you mean column c in t1 which is also in the scope of the sub query. Received on Mon Oct 27 2003 - 08:36:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US