SQL to generate a list of full calendar of dates

I'm trying to generate a list of dates, in view of the current date. For example, for today, March 10, I want the dates of March to be included. This is for a calendar app and because of that I have to fill in the calendar with pre and post days. For example, for March, the following dates should be included:

17/02/2011
28/02/2011

All dates in March... AND

01/04/2011
02/04/2011

If you look at a calendar, it usually begins a Sunday... depending on where you are. I need all the dates returned to account for the additional days before and after the month in question. That make sense?

Any help is greatly appreciated.

That's what I'd like to see:

Order DateValue week day month
02/27/2011 1 1 27 2
02/28/2011 2, 2 28 2
03/01/2011 3, 3 1 3
03/02/2011 4, 4 2 3
03/03/2011 5, 5 3 3
03/04/2011 6, 6 4 3
03/05/2011 7, 7 5 3
03/06/2011 8 1 6-3
03/07/2011 9, 2 7 3
10 03/08/2011 3 8 3
03/09/2011 11, 4 9 3
03/10/2011 12, 5 10 3
13/03/11/2011 6 11 3
03/12/2011 14 7 12 3
15 03/13/2011 1 13 3
16 03/14/2 / 2011 14 3
17 03/15/2011 3 15 3
18 03/16/4 / 2011 16 3
19 03/17/5 / 2011 17 3
20 03/18/2011 6 18 3
21 03/19/2011 7 19 3
22 03/20/2011 1 20 3
23 03/21/2 / 2011 21 3
24 03/22/3 / 2011 22 3
25 03/23/2011 4 23 3
26 03/24/2011 5 24 3
27 03/25/2011 6 25 3
28 03/26/7 / 2011 26 3
29 03/27/2011 1 27 3
03/28/2011 30, 2 28 3
31 03/29/3 / 2011 29 3
32 03/30/4 / 2011 30 3
33 03/31/5 / 2011-31-3
2011-01-04 34, 6 1 4
04/02/2011 35, 7 2 4

Hello

Welcome to the Forum!

You say you want
(a) every day in the current month, more
(b) some days may be required from the previous month, so that the list starts on a Sunday, and
(c) some days may be necessary in the next month so that the list ends on a Saturday?

Here's a way to do it:

SELECT     first_date + LEVEL - 1
FROM     (
          SELECT  NEXT_DAY ( TRUNC (SYSDATE, 'MONTH') - 7
                     , 'SUNDAY'
                     )     AS first_date
          ,     NEXT_DAY ( LAST_DAY (SYSDATE) - 1
                     , 'SATURDAY'
                     )     AS last_date
          FROM    dual
     )
CONNECT BY     LEVEL <= last_date + 1 - first_date
;

This assumes that your NLS_DATE_LANGUAGE = "ENGLISH." If it's another language, translate 'SUNDAY' and 'SATURDAY' in that language.

Tags: Database

Similar Questions

  • Is there a way to generate a list of names of files in an album?

    I want to generate a list of the contents in an album (photos in the album are spread over various issues). I need the full path names, such as:

    C:\ThisFolder\Thatpic.jpg

    C:\ThatFolder\Thispic.jpg

    etc.

    Is there a way to do it or should I go through the tedious process of manually check the location of the file for each photo in the album?

    function() {return A.apply (null, [this] .concat ($A (arguments)))}

    Is the "file_albums.csv" file... contain data that lookes like it (give a full path to the file name):

    Yes.

    The file "file.csv" includes a column of Album name for each file?

    He did a 'Albums' column, giving the list of albums that each file is current.  And it has a 'Positions of the Album' column, giving to the corresponding locations of the file to each of these albums.

    I have attached sample output for a 4-photo catalog with two albums.

  • How to change the language setting in Microsoft word to generate a list of references?

    How to change the language setting in Microsoft word to generate a list of references?

    I use a Mac with the (traditional) Chinese language setting, and I need the reference generatinga list for my document in English!

    If you don't get an answer here, try the forums devoted entirely to problems with MS applications:

    http://answers.Microsoft.com/en-us/Mac/forum/MacWord

  • SQL query generated by insertion/update of data vi?

    Hello!

    I'm new to LabView, now rated as my company's management plans to buy licenses for several developers. I'm now playing with the database connectivity toolkit and try to insert/updated updated data sets. Everything is good with simple tables, but when I try to execute relatively complex queries are often mistakes LabView diagnosed everything as "syntax error in Update statement" or something like that with no specific details.

    Is it possible to read the actual SQL queries generated by these vi or is there a (preferably free) tool to monitor all SQL queries called by my LabView program?

    Here is the link I promised last night. It includes a review of the issues with the CSD and why it is not necessary. There is also a link with some drivers that allow you to do what you need to do and are free - and a brief tutorial on the access to databases.

    Mike...

  • How can you generate a list of unmet needs in a customized in NO Gateway requirements report?

    I am creating a custom report that lists the requirements that are covered (i.e., a traceability matrix) and also a list of unmet needs.  I think I have the first part figured out, but I can't understand how to generate a list of unmet, preferably by document.  I would like to see something like this:

    2 needs not covered

    2.1 documentA

    Covered requirements: 5

    -Req3

    -Req5

    -Req10

    -Req12

    -Req13

    Does anyone know how to do this?

    Also, is there any documentation on what are the various data elements?  (For example, what is a "requirement of the sheet"?)

    Thank you!

    Tom

    Hi Tom,

    I have attached a modified version of the example of Word which comes with requirements 1.1 gateway. In this sample project, I have reproduced the traceability matrix report and a slight modification to only show requirements discovered at the end of the report. Please note that this is not a complete solution, but it should be enough to help you move forward on the right track.

  • I can generate a list of addresses of a polygon shape in the streets & trips?

    I've built a number of forms of polygon closed in Microsoft streets & trips 2011. Is there a way to generate a list of addresses contained in these forms? Thank you.

    Hello

    Check with streets and trips in support of the community and Forum.

    Streets & Trips
    http://www.Microsoft.com/streets/en-us/default.aspx

    Streets & Trips - help and Support
    http://www.Microsoft.com/streets/en-us/support-and-training.aspx

    Streets and travel community
    http://www.Microsoft.com/streets/en-us/community-and-news.aspx

    Streets and travel Forum
    http://social.Microsoft.com/forums/en-us/streetsandtrips/threads

    Support for MapPoint, streets & trips and Highway
    http://support.Microsoft.com/ph/851

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • generate a list of installed programs

    How can I generate a list of installed programs? I'm considering upgrading to Windows 7 but wish to consider programs that I might upgrade to W7 compatibility.

    http://www.Belarc.com/free_download.html

  • The progress bar just kept scanning without generating a list of updates or error messages

    I have a hp G70-463 CL portable 2009. It works well until March 2016 when it could not download updates Windows 7 Ultimate. The progress bar just kept scanning without generating a list of updates or error messages. I reinstalled Windows, but this does not solve the problem. The PC otherwise works fine. I can download the software successfully. What is going on?

    You can reset the Windows Update components by running the Fixit on this page. But if there is malware present, she will continue to reset the connection to the update servers:

    How to reset the Windows Update components

    http://support.Microsoft.com/kb/971058

    Suggest you download and save the Fixit. Then configure the system before the clean boot by running:

    How to troubleshoot a problem by performing a clean boot in Windows Vista/Windows 7

    http://support.Microsoft.com/kb/929135

    Once the Fixit has been downloaded and the system is started in the pure State, check that the native Windows Firewall is now on if a 3rd party firewall has been used previously. Now run the Fixit and choose the default mode. Restart once it's done and see if the system can be connected to the update servers. If he can't, then rerun the Fixit and choose aggressive mode. Turn it back on when he finished the race and updates.

    I suggest before you stop and install the updates, disconnect from the Internet, first.

  • API to get the list of contacts, calendar, information from music files?

    Hello

    Is there support for the list of contacts, calendar list information files or music from the platform. In the case where a user synchronizes contacts, calendars, music files using a smartphone BlackBerry bridge, how applications can get access to this information?

    concerning

    Arun

    They have not released these APIs to interact with calendar and contacts features yet. They are still working on this feature for the PlayBook, but I think we would expect that in the next version of the OS.

    I'm not sure of the bridge and the music info, but I'm sure that these APIs are in the same boat as the contacts and calendar.

    Scott

  • How can I generate a list of all the albums I have in my music library

    How can I generate a list of all the albums I have in my music library

    See http://answers.microsoft.com/en-us/windows/forum/windows_7-sound/how-to-print-a-list-of-items-in-the-window-media/6490fe4f-bb0e-4afa-97ca-3ce58c3aaeba

    but, if you only do this several times, you can use this procedure instead:

    Open a command prompt in your folder music [shift-right click on the name of the folder in the Windows Explorer & select a window of commands here]

    Run the dir/ad/b /s > AlbumList.txt

    Then open the text file in Word and he put away: -.

    Replaceyourusernamewith Nothing \Music\ C:\Users\

    Replace-with ^ t [the code of the tab]

    Select all, convert table to use the trademarks of the tab as column separators

    Select column 1 [the artists], and delete

    If there is garbage in all 3 columns - go just delete the columns thus

    That should leave a unique list of album names

  • ORA-06528: PL/SQL Profiler generator runtime error

    Version 11.2.0.3.  I have installad DBMS_PROFILER:

    SYS AS SYSDBA > @?/rdbms/admin/profload.sql

    SYS AS SYSDBA > @?/rdbms/admin/proftab.sql


    I tried to use dbms_profiler.start_profiler in PLSQL code with user NUFN and discovered that lacked the NUFN user privileges on the objects of the Profiler. So I ran the following grants:

    grant the update, insert and delete on plsql_profiler_units to NUFN;

    grant the update, insert and delete on plsql_profiler_runs to NUFN;

    Grant execute on DBMS_PROFILER to NUFN;

    But still no luck:

    SQL > START

    dbms_profiler.start_profiler ('test1');

    EXECUTE IMMEDIATE 'select max (STATS_UPDATE_TIME), owner of the DBA_TAB_STATS_HISTORY group from owner to owner.

    dbms_profiler.stop_profiler ();

    END;

    /

    BEGIN

    *

    ERROR on line 1:

    ORA-06528: PL/SQL Profiler generator runtime error

    ORA-06512: at "SYS." DBMS_PROFILER", line 123

    ORA-06512: at "SYS." DBMS_PROFILER", line 132

    ORA-06512: at line 2

    I can't find what is missing from my user NUFN for her to be able to run DBMS_PROFILER.  Help, please!

    Thanks Bella, I had not run @?/rdbms/admin/proftab.sql as my user NUFN but as sys.  But you know what?  Even after execution of @?/rdbms/admin/proftab.sql as NUFN, the problem persisted!

    So I traced my session, read the trace file and found nothing wrong (but I have no experience in finding fault with the workings of dbms_profiler).  But I found the SQL code executed by the dbms_profiler.start_profiler command, which is:

    PARSING IN CURSOR #4574691968 len = 155 dep = 2 uid = 155 oct 2 lid = 155 = tim = hv 530047132716 = ad 3718124591 = "7000000946da848" sqlid = "akx2pxvftw51g."

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL,: B1,: B2, USER) RETURN RUNID IN: O0

    END OF STMT

    ANALYSIS #4574691968:c = 315, e = 844, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 1, plh = 0, tim = 530047132715

    I tried manually the same HOME, and bingo, I discovered the cause of my problem:

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL, sysdate, 'manually', 'ME');

    ORA-01950: no privileges on tablespace execution times

    After performing ALTER USER NUFN QUOTA UNLIMITED ON STATES; the problem has been resolved.

    Conclusion: after DBMS_PROFILER installation for a user, make sure that the user can write in objects DBMS_PROFILER (SUBSIDIES and QUOTAS).

  • Generate a list of virtual machines online

    I want to generate a list of the virtual machines that are online.  I want to confirm not only that the virtual machine is running, but the guest operating system responds to the pings, and there is a network connectivity from end to end from a specific location in the data center (where I'm going to run my script of)

    Here's what I do:

    Draw a list of VMS in vCenter

    Ping each VM by one

    Determine whether or not I get a response from the ping command and capture and store the result in a variable

    If I get a reply, mark this VM as "online."

    If I get no answer, mark the virtual machine as 'offline '.

    Export to CSV format

    How can I do this with PowerCLI?

    Thank you!


    Try something like this

    Get-VM | Select Name,PowerState,    @{N="Ping";E={        if($_.PowerState -eq "PoweredOn" -and (Test-Connection -ComputerName $_.Name)){"Online"}else{"Offline"}    }} |Export-Csv VM-status.csv -NoTypeInformation -UseCulture
    

    It assumes that the host name of the virtual machine is the same name of the virtual machine.

    If the virtual machine is turned off, the ping test is not run

  • SQL to generate the last weeks date (not a stored procedure)

    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    Varun says:
    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    below should help you get started

      1* SELECT SYSDATE-LEVEL from dual CONNECT BY LEVEL < 8
    SQL> /
    
    SYSDATE-L
    ---------
    21-APR-13
    20-APR-13
    19-APR-13
    18-APR-13
    17-APR-13
    16-APR-13
    15-APR-13
    
    7 rows selected.
    
  • View full calendar on the form

    Hello

    I use Apex 4.2 and want to view the full calendar on the form.

    to do this, I use

    http://www.mredkj.com/JavaScript/calendar.html

    link.

    I created two points on the form: P1_MONTH AND: P2_YEAR and submit created the button on the page.



    code defined below is given in this link.
    <html>
    <head>
    <title>Calendar</title>
    
    <script language="JavaScript" src="CalendarDisplay110.js"></script>
    <script language="JavaScript">
    <!--
    
    calendarTry = new CalendarDisplay();
    calendarTry.setNavigationOn("calendarTry");
    calendarTry.setOpenOn();
    calendarTry.setAutoCloseOn();
    calendarTry.setLinkOn("fillInFields");
    calendarTry.setDayFormat(calendarTry.TWO_LETTER);
         
    function calendarOpener(frm)
    {
         var m = frm.month.options[frm.month.selectedIndex].value;
         var d = frm.day.value;
         var y = frm.year.value;
         var showMonth = true;
         if (frm.yearMonth[1].checked)
         {
              showMonth = false;
         }
              
         if (showMonth)
         {
              calendarTry.createMonth(m, d, y);
         }
         else
         {
              calendarTry.createYear(m, d, y);
         }
         
    }
    
    function fillInFields(month, day, year)
    {
         document.frmCalendar.month.selectedIndex = month;
         document.frmCalendar.day.value = day;
         document.frmCalendar.year.value = year;
    }
    
    //-->
    </script>
    </head>
    
    <body>
    
    <form name="frmCalendar">
    <table border="1" cellpadding="5" cellspacing="0">
         <tr>
              <td>Month</td>
              <td>Day (1-31)</td>
              <td>Year (e.g. 2002)</td>
         </tr>
         <tr>
              <td align="center">
                   <select name="month">
                        <option value="0">January</option>
                        <option value="1">February</option>
                        <option value="2">March</option>
                        <option value="3">April</option>
                        <option value="4">May</option>
                        <option value="5">June</option>
                        <option value="6">July</option>
                        <option value="7">August</option>
                        <option value="8">September</option>
                        <option value="9">October</option>
                        <option value="10">November</option>
                        <option value="11">December</option>
                   </select>
              </td>
              <td align="center"><input type="text" name="day" size="3" /></td>
              <td align="center"><input type="text" name="year" size="5" value="2002" /></td>
         </tr>
         <tr>
              <td colspan="3" align="center">
              <input type="radio" name="yearMonth" value="month" checked /> Month
              <input type="radio" name="yearMonth" value="year" /> Year
              </td>
         </tr>
         <tr>
              <td colspan="3" align="center">
              <input type="button" value="Open Calendar" onclick="calendarOpener(this.form);" />
              </td>
         </tr>
    </table>
    </form>
    
    </body>
    </html>
    What changes I should in the body section of this code to use my own agenda: P1_MONTH and: P1_YEAR instead of html code.


    Thanks & looks
    CORINE.

    Published by: Sophie on February 25, 2013 22:01

    There was an extra * {* at the beginning of the file, I noticed that in your responses above as well.}

    Thank you
    Vikram

  • Generate a list of URLS that are a hyperlink in a document?

    Hello world

    I did some research and can't seem to find an answer to this question:

    Is there a way to generate a list of all URLS that are hyperlinked in an InDesign document? I use CS6.

    Thank you very much.

    ElizabethGM wrote:

    I really hope that you are wrong!

    Oooh - scripts are nothing to worry about. On the contrary: there are many small functions and routines that are useful only for very few people, if Adobe has not added them to InDesign. This is where a script can help you!

    Here's a quick which includes all hyperlinks, shows them on the screen and saves their list in your Documents folder. Save it as "collectHyperlinks.jsx" in your folder User Scripts, and then double-click it in the Scripts panel to run.

    var list = [];
    for (a=0; a		   

Maybe you are looking for