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

Home -> Community -> Usenet -> comp.databases.theory -> Re: How to identify a column in order by clause

Re: How to identify a column in order by clause

From: doichi <doichinka_at_abv.bg>
Date: 7 Jan 2005 15:51:12 -0800
Message-ID: <1105141872.244778.219040@c13g2000cwb.googlegroups.com>


Mr. Morgan,
10x for your long dump... without Oracle near at hand, I missmatched the case with table aliases (if table alias present, you must use it instead of table name to reference cols in ORDER BY clause, otherwise Oracle complains):
SQL> SELECT ename, sal FROM emp WHERE ROWNUM < 2 2 ORDER BY emp.sal;

ENAME SAL
---------- ---------
SMITH 800 SQL> 1
1* SELECT ename, sal FROM emp WHERE ROWNUM < 2 SQL> c/emp/emp e
1* SELECT ename, sal FROM emp e WHERE ROWNUM < 2 SQL> 2
2* ORDER BY emp.sal
SQL> /
ORDER BY emp.sal
*
ERROR at line 2:
ORA-00904: invalid column name Received on Fri Jan 07 2005 - 17:51:12 CST

Original text of this message

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