Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle returns null pointer and ordering date ?

Re: oracle returns null pointer and ordering date ?

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 4 Nov 1999 09:45:47 +0100
Message-ID: <7vrh6j$js$1@oceanite.cybercable.fr>


You can use "group by trunc(creation_date, 'Month')".

--
Have a nice day
Michel

<javanewbie_at_my-deja.com> a écrit dans le message : 7vqvg4$vkt$1_at_nnrp1.deja.com...
> 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 - 02:45:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US