Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

First day of every month of all twelve months in one query..

Posted on 2014-03-06
2
Medium Priority
?
1,618 Views
Last Modified: 2014-03-06
How do I get first day of every month of all twelve months in one single query
0
Comment
Question by:d27m11y
  • 2
2 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 39910942
assuming you mean for the current calendar year, try this...


    SELECT NEXT_DAY(ADD_MONTHS(TRUNC(SYSDATE, 'yyyy'), LEVEL - 1) - 1, 'Friday')
      FROM DUAL
CONNECT BY LEVEL <= 12
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 39911177
I'm not sure why, but I thought that question read get the first Friday of every month
If it's just the first of each month, that's even easier


   SELECT  ADD_MONTHS(TRUNC(SYSDATE, 'yyyy'), LEVEL - 1)
      FROM DUAL
CONNECT BY LEVEL <= 12
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question