Alias in ORDER BY [message #399555] |
Thu, 23 April 2009 00:13 |
ramesh55.sse
Messages: 262 Registered: December 2008 Location: Hyderabad
|
Senior Member |
|
|
SQL> SELECT empno,ename,sal "newsal"
FROM emp1
ORDER BY newsal;
SQL> /
ORDER BY newsal
*
ERROR at line 3:
ORA-00904: "NEWSAL": invalid identifier
SQL> SELECT empno,ename,sal "NEWSAL"
FROM emp1
ORDER BY newsal;
Why it's not raising error.
|
|
|
Re: Alias in ORDER BY [message #399559 is a reply to message #399555] |
Thu, 23 April 2009 00:38 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
My guess is that you know pretty well what's going on here.
Why else would you use the double quotes in the alias?
Time to start thinking & reading some docs before posting each question you can think of.
|
|
|
|
|
Re: Alias in ORDER BY [message #400078 is a reply to message #399555] |
Sat, 25 April 2009 15:34 |
|
Barbara Boehmer
Messages: 9099 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Consider that the following also does not raise an error.
select empno, ename, sal "newsal" from emp order by "newsal";
It has to do with case sensitivity caused by quoting. Otherwise, everything defaults to upper case.
|
|
|