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 -> Date Sort Order Incorrect!

Date Sort Order Incorrect!

From: James <thanatic_at_telstra.com>
Date: 6 Aug 2004 00:55:38 -0700
Message-ID: <7377f06c.0408052355.3ce32fb8@posting.google.com>


I thought oracle ordered date columns by the full internal value of the date (including seconds)

When I test this, it seems as if I am wrong!!!!

I'm guessing that Oracle applies the default date format mask to do the sort.

Is this correct? If it is then I am mad/sad.

Example:

desc plog:
action_code number
action_date date

select action_code,to_char(action_date,'DD-MON-YYYY HH24:MM:SS'),action_date
from plog where vehicle_id=151855 order by action_date;

  1 05-AUG-2004 16:08:37 05-AUG-04
  1 05-AUG-2004 16:08:57 05-AUG-04 
  1 05-AUG-2004 16:08:51 05-AUG-04 <-- wrong!  
 16 05-AUG-2004 16:08:00 05-AUG-04 <-- in fact they are mostly wrong!
  2 05-AUG-2004 19:08:45 05-AUG-04
  2 05-AUG-2004 19:08:15 05-AUG-04
  2 05-AUG-2004 19:08:32 05-AUG-04
 11 05-AUG-2004 20:08:54 05-AUG-04

--
Kind regards,
James
Received on Fri Aug 06 2004 - 02:55:38 CDT

Original text of this message

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