I am guessing that Oracle automatically convert any alias to CAP.
As a result, in the first sql statement, when you put double quote over "newdate", the double quote keeps the alia in lower case. While in the ORDER BY clause, NEWDATE is converted to CAP. Thus, there's a missmatch.
1 SELECT SYSDATE "NEWDATE" FROM DUAL
2* ORDER BY newdate
SQL> /
NEWDATE
---------
11-APR-02
SQL> SELECT SYSDATE AS newdate FROM DUAL
2 ORDER BY newdate;
NEWDATE
---------
11-APR-02
SQL> EDIT
Wrote file afiedt.buf
1 SELECT SYSDATE newdate FROM DUAL
2* ORDER BY newdate
SQL> /
NEWDATE
---------
11-APR-02
1 SELECT SYSDATE "newdate" FROM DUAL
2* ORDER BY LOWER('newdate')
SQL> /
Bookmarks