Why Does One Order by Work and the Other Does not for TO_CHAR (date,format)
Hi folks
it is Monday and my brain is not working, I guess
I am trying to figure out why the first sql does not work and the second sql does
I have included the test case , if needed
Thanks for any assistnace
Jim
select
TO_CHAR (col_date,'YYYY-MM-DD HH:MM;SS') col_date
from
test_dates
order by
TO_CHAR (col_date,'YYYY-MM-DD HH:MM;SS');
*
ERROR at line 2:
ORA-01722: invalid number
select
TO_CHAR (col_date,'YYYY-MM-DD HH:MM;SS') col_date
from
test_dates
order by
1;
COL_DATE
-------------------
2014-03-20 08:03;42
2014-03-20 08:03;43
2014-03-21 08:03;42
2014-03-21 08:03;42