Fiscal Year SQL query [message #340187] |
Mon, 11 August 2008 18:47  |
bztom33
Messages: 95 Registered: June 2005
|
Member |
|
|
Hi,
I would like to generate a list of 5 previous and future fiscal year from the current fiscal year.
This query generates only the current fiscal year.
select to_char(sysdate ,'YYYY'),to_char(sysdate + 365, 'YYYY') from dual;
Thanks,
Tom
|
|
|
|
|
|
Re: Fiscal Year SQL query [message #341223 is a reply to message #341057] |
Sun, 17 August 2008 21:40   |
bztom33
Messages: 95 Registered: June 2005
|
Member |
|
|
I did not rely entirely from the SQL query to generate a list of fiscal years.
I get the current and next fiscal year from the following query.
select to_char(sysdate ,'YYYY'),to_char(sysdate + 365, 'YYYY') from dual;
The key thing is to get the current and next fiscal year from Oracle SQL query, then I can generate the rest of the fiscal years programmatically out side of Oracle query in a for loop.
|
|
|
Re: Fiscal Year SQL query [message #341247 is a reply to message #341223] |
Sun, 17 August 2008 23:44  |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
What happened to your query when you executed it on 01-JAN-2008?
Why don't you want to do it in a single SQL?
Why if you can know the other years programmatically, you can't know the current and next ones in the same way? I don't know any language that can't return you the current year.
Regards
Michel
|
|
|