Solved

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

Posted on 2014-03-06
2
1,439 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

751 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