Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:10g
Hello All,
I have encountered an exception while running this query in hibernate.
String str6 = "SELECT TO_CHAR(ADD_MONTHS( TO_DATE(?,'DD/MM/YYYY'), (ROWNUM-1)),'Mon-YYYY')
as MONYR, ADD_MONTHS(TO_DATE(?,'DD/MM/YYYY'),(ROWNUM-1))
as DD_DATE FROM CL_Enroll as clEnroll WHERE ROWNUM <= MONTHS_BETWEEN(TO_DATE(?,'DD/MM/YYYY'),TO_DATE(?,'DD/MM/YYYY'))+1
ORDER BY DD_DATE ASC";
The error is
"DD_DATE": invalid identifier
when I run this query after removing the bold portion , the query runs successfully.But I need to add the order by clause.
This runs successfully:-
String str6 = "SELECT TO_CHAR(ADD_MONTHS( TO_DATE(?,'DD/MM/YYYY'), (ROWNUM-1)),'Mon-YYYY') as MONYR, ADD_MONTHS(TO_DATE(?,'DD/MM/YYYY'),(ROWNUM-1)) as DD_DATE FROM CL_Enroll as clEnroll WHERE ROWNUM <= MONTHS_BETWEEN(TO_DATE(?,'DD/MM/YYYY'),TO_DATE(?,'DD/MM/YYYY'))+1
So how can I order the result set on the basis of anonymous column which in my case is DD_DATE .
Thanx in Advance.
Regards,
Abhishek