DATES/Years/Quarters

Hi, I need to have two List of Values:
One that shows this year and next year:
2011 d, 01/01/2011 r
2012 d, 01/01/2012 r

and one
Quarter One d, 01/01/2010 r
Quarter Two d, 04/01/2010 r
Quarter Three d, 07/01/2010 r
Quarter Four d, 10/01/2010 r

BUT they need to changed based on the changing of time, 2013,2014,etc
Open to better ideas also...

Thanks, Bill
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DavidSenior Oracle Database AdministratorCommented:
One idea is to parse the sysdate year and increment it for each item in your LOV, e.g., TO_DATE(sysdate,'RR') +1
0
BILL CarlisleAPEX DeveloperAuthor Commented:
this only gives one row?? TO_DATE(sysdate,'RR') +1

For the two years this is what I have so far:
select to_char(add_months(sysdate,rownum*12 -12),'yyyy') d,
           trunc(add_months(sysdate, rownum*12 -12),'year') r
from my_table --- must have two + rows
where rownum <3
0
BILL CarlisleAPEX DeveloperAuthor Commented:
For Quarter:
select 'Q'||rownum d, trunc(add_months(sysdate, rownum*3),'q') r
from om_org
where rownum <5
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

BILL CarlisleAPEX DeveloperAuthor Commented:
select 'Q'||rownum d, trunc(add_months(to_date(:P1051_YEAR), rownum*3 -3),'q') r
from om_org
where rownum <5
0
BILL CarlisleAPEX DeveloperAuthor Commented:
These feed an IR report
Only one YEAR can be selected but one or more quarters can be selected.

So now I need the best was to add these to the WHERE statement
WHERE  ???????
0
awking00Information Technology SpecialistCommented:
For list1 -
select add_months(trunc(sysdate,'yyyy'),(level - 1) * 12)
from dual
connect by level <= 2;

For list2 -
select add_months(trunc(sysdate,'yyyy'),(level - 1) * 3)
from dual
connect by level <= 4;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
For clarity, add alias -
select add_months(trunc(sysdate,'yyyy'),(level - 1) * 12) as year
from dual
connect by level <= 2;

select add_months(trunc(sysdate,'yyyy'),(level - 1) * 3) as quarter
from dual
connect by level <= 4;
0
BILL CarlisleAPEX DeveloperAuthor Commented:
Thank you! Sorry for delay of response... I used the connect by and forgot to thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.