Home » SQL & PL/SQL » SQL & PL/SQL » Sorting weird date format
Sorting weird date format [message #188372] Fri, 18 August 2006 04:25 Go to next message
Duke
Messages: 14
Registered: August 2006
Junior Member
Just a small brain teaser...

How would you guys be sorting / selecting values from a column with weird date format: 24-10-2004,
I need to find values within a certain range....
Re: Sorting weird date format [message #188375 is a reply to message #188372] Fri, 18 August 2006 04:34 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Dates are dates. The format is irrelevant. If you sort by a date, the format does not matter.

If it is a varchar2, convert it to a date and sort.
MHE
Re: Sorting weird date format [message #188376 is a reply to message #188372] Fri, 18 August 2006 04:34 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
order by to_date(your_field, 'dd-mm-yyyy')
Re: Sorting weird date format [message #188377 is a reply to message #188376] Fri, 18 August 2006 04:35 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
hm, must be bug in forum. I was SURE I beat you, Maarten!
Re: Sorting weird date format [message #188378 is a reply to message #188377] Fri, 18 August 2006 04:37 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
No, I have priority set to GOD Very Happy

MHE

Re: Sorting weird date format [message #188382 is a reply to message #188372] Fri, 18 August 2006 05:15 Go to previous messageGo to next message
Duke
Messages: 14
Registered: August 2006
Junior Member
priority set to god....
then I won't like to be your son...
Wink

Thanks all,

seems like to_date is my friend....
Re: Sorting weird date format [message #188395 is a reply to message #188382] Fri, 18 August 2006 06:36 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
GOD = Good Oracle Developer Wink

MHE
Previous Topic: Comparing two tables
Next Topic: WHats next
Goto Forum:
  


Current Time: Tue Dec 06 11:54:10 CST 2016

Total time taken to generate the page: 0.14751 seconds