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>
>
>
> 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
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
- The first makes sense
- The first doesn't require use of a math routine to perform the addition
- The first is standard Oracle syntax
- 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)