Home » SQL & PL/SQL » SQL & PL/SQL » Custom Sort (Oracle 10g, Win XP)
Custom Sort [message #402748] Tue, 12 May 2009 05:33 Go to next message
freakabhi
Messages: 74
Registered: November 2007
Location: mumbai
Member
Hi All,

Is there any way to define Custom Sort order in the SQL, like when u sort minthname , it will give April, august......
but I want like Januart, February............

Please suggest me some ideas, if somebody has any of it..

thanks,
freakabhi
Re: Custom Sort [message #402749 is a reply to message #402748] Tue, 12 May 2009 05:35 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Try order by to_date(monthname,'MONTH')

Please post your sql next time onwards...

By
Vamsi
Re: Custom Sort [message #402755 is a reply to message #402748] Tue, 12 May 2009 05:52 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Is there any way to define Custom Sort order in the SQL

Yes there are many ways.

Quote:
like when u sort minthname , it will give April, august...... but I want like Januart, February............

There is surely a problem with your point key.
Sort by month number and month name.

Regards
Michel
Re: Custom Sort [message #402782 is a reply to message #402748] Tue, 12 May 2009 07:59 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You can order by any function that you like.
All you need is a function that maps your data onto a set of numeric or character values that are ordered how you want them.
Previous Topic: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Next Topic: dbms_utility.comma_to_table (merged)
Goto Forum:
  


Current Time: Fri Feb 14 09:31:18 CST 2025