Re: How to identify a column in order by clause

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Fri, 07 Jan 2005 09:02:44 -0800
Message-ID: <41debf85$1_1_at_127.0.0.1>


Mikito Harakiri wrote:

> "DA Morgan" <damorgan_at_x.washington.edu> wrote in message
> news:41deb545$1_3_at_127.0.0.1...
>

>>The best solution is, as always, positional notation
>>
>>SQL> ed
>>Wrote file afiedt.buf
>>
>>   1  select table_name, column_name AS COLNAME
>>   2  from user_tab_columns
>>   3  where table_name = 'SERVERS'
>>   4* ORDER BY 2

>
>
> The positional notation is misborn ANSI SQL invention. Why is that
>
> select table_name, column_name AS COLNAME
> from user_tab_columns
> where table_name = 'SERVERS'
> ORDER BY 2
>
> is different from
>
> select table_name, column_name AS COLNAME
> from user_tab_columns
> where table_name = 'SERVERS'
> ORDER BY 1+1
  1. The first makes sense
  2. The first doesn't require use of a math routine to perform the addition
  3. The first is standard Oracle syntax
  4. The second is no different from: ORDER BY 4*0.5: Functional but without purpose. -- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)
Received on Fri Jan 07 2005 - 18:02:44 CET

Original text of this message