Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Order of execution of Select clauses
Pria wrote:
> Hi All,
>
> Please correct me if i am wrong.
>
> Internally, the order of execution for a SELECT statement is as
> follows:
> FROM clause
> WHERE clause
> SELECT clause
> ORDER BY clause
> and Oracle allows Order by the table columns that are not included in
> the SELECT clause.
>
> If Order By clause is executed after select clause in select statement,
> then how does Oracle Order by columns that are not included in the
> SELECT clause internally.
>
> Thanks in Advance
> Pria
The whole query is parsed before it is executed. The query plan
*will* internally select those columns, along with the asked-for
data, perhaps filling a temp table internally. It then sorts the
rows according to the columns you specify, and then just returns
the columns you ask for.
HTH,
Joe Weinstein at BEA Systems
Received on Fri Feb 10 2006 - 15:47:37 CST