Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle returns null pointer and ordering date ?
Try this :
String str1 = "SELECT TO_CHAR(creation_date, 'YYYY-MON')
a_creation_date, count(*)
FROM " +
" foreign_worker_master where creation_date is not null and " + " doctor_code is not null " + " and (creation_date > TO_DATE('"+lbFromDateStart.getText()+"','DD/MM/YYYY') and " +
Let me know if it works.
javanewbie_at_my-deja.com wrote:
> String str1 = "SELECT TO_CHAR(creation_date, 'YYYY-MON'), count(*)
> FROM " +
> " foreign_worker_master where creation_date is not null and " +
> " doctor_code is not null " +
> " and (creation_date > TO_DATE('"+lbFromDateStart.getText()
> +"','DD/MM/YYYY') and " +
> " creation_date < TO_DATE('"+lbFromDateStop.getText()
> +"','DD/MM/YYYY') ) " +
> " group by TO_CHAR(creation_date, 'YYYY-MON') order by
> creation_date ";
>
> when i try to execute the above sql with the order by , it returned
> this error :-
>
> C:\JavaClass>java Dist_FW_Docmonth
> null
> java.lang.NullPointerException
>
> there is no error when i do not use the order by clause.
>
> is there anything wrong with the above sql statement.
>
> i am trying to order it so that is shows
>
> 1999-MAR
> 1999-APR
> 1999-MAY
>
> now, it is showing , because it is grouping by TO_CHAR...
>
> 1999-ARP
> 1999-AUG
> 1999-DEC
> 1999-FEB
>
> how do i solve this problem ?
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Nov 04 1999 - 04:36:09 CST
![]() |
![]() |