Solved

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

Posted on 2014-03-06
2
1,341 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 73

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 73

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

803 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