Order by Current Month [message #492393] |
Sun, 30 January 2011 22:59 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
theowais
Messages: 75 Registered: October 2009 Location: Multan
|
Member |
|
|
Hi Experts,
A form has date of birth column.
Date of birth should be displayed according to current month.
Example:
01-jan-1980
01-feb-1975
01-mar-1970
Required:
Let current month is feb then
01-feb-1975
01-mar-1970
01-jan-1980
What should be done?
|
|
|
|
Re: Order by Current Month [message #492424 is a reply to message #492394] |
Mon, 31 January 2011 02:13 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
theowais
Messages: 75 Registered: October 2009 Location: Multan
|
Member |
|
|
Thanks for your reply
CODE:
mod(extract(month from birth)-extract(month from sysdate)+12,12)
The above code is placed in Order By clause, No Result.
Please Explain...
|
|
|
Re: Order by Current Month [message #492426 is a reply to message #492424] |
Mon, 31 January 2011 02:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
I don't know about Forms, but this clause works in SQL.
Maybe your old Forms version does not know "extract" function, in this case use:
to_number(to_char(birth,'MM'))
And maybe you have not a column named "birth".
Regards
Michel
[Updated on: Mon, 31 January 2011 02:25] Report message to a moderator
|
|
|
Re: Order by Current Month [message #492429 is a reply to message #492426] |
Mon, 31 January 2011 03:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
theowais
Messages: 75 Registered: October 2009 Location: Multan
|
Member |
|
|
Thanks for your reply
CODE:
to_number(to_char(birth,'MM'))
The above code is placed in Order By clause,
It is working for displaying records 1...12 month not for according to current month.
|
|
|
Re: Order by Current Month [message #492430 is a reply to message #492429] |
Mon, 31 January 2011 03:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
I meant replace "EXTRACT..." by "TO_NUMBER(TO_CHAR..." in the expression I first gave, NOT to use just that.
Regards
Michel
|
|
|