in reply to Need help sorting timestamps

I think I figured out what you're trying to do, but it wasn't easy :) ... the indentation doesn't seem to match the actual code structure.

Is the sorting the only things that doesn't work? What to the values look like? Are they time of day? If so, how do you deal with different days, am/pm, etc. Showing some data in/out would help.

Replies are listed 'Best First'.
Re: Re: Time sorting please help
by swarddb (Novice) on Jul 18, 2001 at 20:50 UTC
    the results look like:
    01-APR-01 01-JUL-01 18286 5.46 0.96 17504.48 18286 22610.58 4190 01-JUN-01 27934 5.75 1.04 28809.37 27934 35830.37 6334 01-MAY-01 02-JUL-01 20979 6.14 0.95 19860.98 20979 27195.53 4495 02-JUN-01 24223 5.52 0.98 23598.10 24223 30321.18 5560 03-JUL-01 20851 5.81 0.93 19363.53 20851 26090.85 4585 03-JUN-01 23594 5.36 0.96 22680.82 23594 27655.15 5213 04-JUL-01 16919 5.80 0.99 16727.62 16919 21459.60 3759
    That is with a order by in the SQL statement as well.
      It appears to be doing what you told it to do, not what you want it to do. :)

      I think you did the trunc, which probably made it a string, then sorted. If you look at the results, they are sorted as if the timestamp is a string.

      Why not sort on the whole (date/time) thing, which Oracle will do correctly, then in your Perl code do the truncating/formatting.