List of the months according to current date [message #340542] |
Wed, 13 August 2008 04:29  |
|
Hi All,
From the first date of the current year till current date , how can we know the list of the months.
If I execute the query the result should be as below which includes current month also
Months
---------
January
February
March
April
May
June
July
August
Best Regards,
Mudabbir
|
|
|
|
|
|
|
Re: List of the months according to current date [message #340556 is a reply to message #340553] |
Wed, 13 August 2008 05:05   |
|
Thanks Neal, You were very precise,
I modified the code however a bit to suit my needs. As follows
select to_char(add_months(TRUNC(SYSDATE,'Y'), level-1), 'Month')
from dual
connect by level <= months_between(sysdate, TRUNC(SYSDATE,'Y'))+1
order by add_months(TRUNC(SYSDATE,'Y'), level-1)
Thanks all for the Help.
|
|
|
Re: List of the months according to current date [message #340557 is a reply to message #340554] |
Wed, 13 August 2008 05:06   |
 |
Michel Cadot
Messages: 68734 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Don't put solution only hint or clue as requested in OraFAQ Forum Guide, "Responding to Posts" section:
Quote: | When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usual to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, and not provide complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.
|
@Olivia,
You're certainly unable or unwilling to read and follow guidelines.
Regards
Michel
|
|
|
Re: List of the months according to current date [message #340602 is a reply to message #340557] |
Wed, 13 August 2008 06:39   |
Olivia
Messages: 519 Registered: June 2008
|
Senior Member |
|
|
Michel Cadot wrote on Wed, 13 August 2008 05:06 | Don't put solution only hint or clue as requested in OraFAQ Forum Guide, "Responding to Posts" section:
Quote: | When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usual to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, and not provide complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.
|
@Olivia,
You're certainly unable or unwilling to read and follow guidelines.
Regards
Michel
|
Sorry Michel...
Initially I was trying to provide some hint to OP.I still remember Frank's advice. But the moment I try to give the solution,it was already been posted. I just made correction to the query.
I didnt know that showing the correct path is an offence!
It can be done using ROWNUM also.
Use SYSDATE+ROWNUM ..Connect by level <= date diff
Regards,
Olivia
[Updated on: Wed, 13 August 2008 06:43] Report message to a moderator
|
|
|
Re: List of the months according to current date [message #340610 is a reply to message #340602] |
Wed, 13 August 2008 07:22  |
 |
Michel Cadot
Messages: 68734 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote: | I didnt know that showing the correct path is an offence!
|
Showing the solution is not an offense, it is just not the way this site chose to work.
Showing the correct path/way is what we want.
And with 220 posts you should know it. I just can't imagine you didn't.
In addition, my post was not just for you but for Cthulhu as well.
By the way, your solutions are not correct as '01-jan-08' is a string and not a date.
Regards
Michel
|
|
|