Finding all Sunday in a month

Dear Community memeber;
Hope all will be fine. I have a query which I am un-able to resolve. The query is that; I want to findout those date which are comming on Sunday in a month. Like I give month JUN-2010. it should be show me all date which occure on sunday.
Thanks in advance.

How abt dis..
select dt from
select trunc(sysdate,'mm')+level-1 dt from dual
connect by level < to_char(last_day(trunc(sysdate,'mm')),'dd')+1
)where to_char(dt,'dy') = 'sun';
and a small block
declare
     l_last_day     number;     
     l_next_sunday     date;
     l_first_sunday     date;
     j number;
begin
     select     next_day(trunc(sysdate,'mm'),'sunday')
     into     l_first_sunday
     from     dual;
     dbms_output.put_line('first sunday is : '||l_first_sunday);
     j := to_number(to_char(to_date(l_first_sunday,'dd-mm-yyyy'),'dd'));
     for i in to_number(to_char(to_date(l_first_sunday,'dd-mm-yyyy'),'dd')) .. to_number(to_char(last_day(trunc(sysdate,'mm')),'dd'))
     loop
          j := j+7;
          exit when j > to_number(to_char(last_day(trunc(sysdate,'mm')),'dd'));          
          dbms_output.put_line('value of j : '||j);
          select     to_date(j||'-'||to_char(sysdate,'mm-yyyy'),'dd-mm-yyyy')
          into     l_next_sunday
          from     dual;
          dbms_output.put_line('Next sunday is : '||to_char(l_next_sunday,'dd-mon-yyyy'));
     end loop;
end;

Similar Messages

  • Help in finding all sundays of an year

    hi all,
    When we seletc a particular year,Can I be able to get the all the sundays of that year?I think using Calendar instance we can do that.but don't have an idea.Someone got faced the same requirement,Pls let me give some idea
    thanx

    u cn wrt it on ppr n ndrstnd, bt frst read teh API 2 chk wot mthods u cn use.
    Seriously, please try to write clearer questions in the future, if the question is structured you have bigger chance that the answer will be structured and clearer.
    About the specific case you are trying to solve - obtain a calendar instance, then use the appropriate set(...) methods to set it to the fist Sunday of the first week in the year you want. Stop here and test that this works as expected - you can check it using some calendar (application or paper, whatever you prefer).
    After that you can add weeks and filter the dates the way you want to meet the requirements, e.g. stop adding when you go into the next year.
    Mike

  • Find all Z programs which are being modified in last month

    hii all,
    I want to find all Z programs which are being modified in last months.Is this possible??.is there any standard or z-program which can give me the detail of all Z-program which are modified.
    It is possible if i get last month Request but suppose if there are more than 100 request per month then it is not possible to go through each individual Request and find Z-programs.
      Waiting for ur reply.
    <removed_by_moderator> ... read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]!
    Thaking You.
    Edited by: Julius Bussche on Jul 17, 2008 7:16 PM

    Hello
    REPORT ZCHPROG.
    TABLES: D010SINF.
    DATA: PROGTXT(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: PROGTXT1(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA:
       BEGIN OF MT OCCURS 0,
    PROG LIKE D010SINF-PROG,
    EDTX LIKE D010SINF-EDTX,
    R3STATE LIKE D010SINF-R3STATE,
    UNAM LIKE D010SINF-UNAM,
    CNAM LIKE D010SINF-CNAM,
    UDAT LIKE D010SINF-UDAT,
    UTIME LIKE D010SINF-UTIME,
    END OF MT,
    N(4),
    PROG(20) TYPE C,
    MIN(10) TYPE C.
    RANGES: UDAT1 FOR D010SINF-UDAT.
    RANGES: UTIME1 FOR D010SINF-UTIME.
    SELECT-OPTIONS: PROG1 FOR D010SINF-PROG,      "
                    UNAM1 FOR D010SINF-UNAM,      "
                    CNAM1 FOR D010SINF-CNAM.      "
    PARAMETERS DEN(4) TYPE C DEFAULT '1'.
    PARAMETERS SEC(5) TYPE C DEFAULT '30'.
    PARAMETERS DOP AS CHECKBOX DEFAULT ' '.
    START-OF-SELECTION.
    IF DOP NE SPACE.
    MIN = SEC * 60.
          UTIME1-SIGN = 'I'.
          UTIME1-OPTION = 'BT'.
          UTIME1-LOW = SY-UZEIT - MIN.
          UTIME1-HIGH = SY-UZEIT.
       APPEND UTIME1.
    ENDIF.
          UDAT1-SIGN = 'I'.
          UDAT1-OPTION = 'BT'.
          UDAT1-LOW = SY-DATUM - DEN.
          UDAT1-HIGH = SY-DATUM.
       APPEND UDAT1.
    SELECT PROG UNAM UDAT UTIME R3STATE EDTX CNAM
    INTO (MT-PROG, MT-UNAM, MT-UDAT, MT-UTIME, MT-R3STATE, MT-EDTX,MT-CNAM )
             FROM D010SINF  WHERE PROG IN PROG1
                                         AND UDAT IN UDAT1
                                         AND UTIME IN UTIME1
                                         AND CNAM IN CNAM1
                                         AND UNAM IN UNAM1.
    APPEND MT.
    ENDSELECT.
    N = 1.
    WRITE: / 'from', UDAT1-LOW, 'to', UDAT1-HIGH.
    SORT MT BY UNAM UDAT UTIME.
    LOOP AT MT.
    WRITE: / MT-CNAM,MT-PROG,MT-UNAM,MT-UDAT, MT-UTIME,
    MT-R3STATE, MT-EDTX.
    N = N + 1.
    ENDLOOP.
    WRITE: / N.

  • How can I find all my photos instead of the just the last six months?

    I need help finding all my photos, instead of just the last six months.

    Which PSE version ?
    The last six month option is generally one of the choices for 'smart albums', now called 'saved searches'.

  • About a month ago I couldn't access 100s of pix from my iPhoto library.  I then went through the process of "re-finding" all missing pix.  I 2x checked that they opened.  Now, I'm having the same original problem!  What's iPhoto doin with my pix?

    About a month ago I couldn't access 100s of pix from my iPhoto library.  I then went through the process of "re-finding" all missing pix.  I 2x checked that they opened.  Now, I'm having the same original problem!  What's iPhoto doing with my pix?  Is there a "batch" fix?

    Try rebuilding the library.
    Hold down the Option and Command keys then launch iPhoto.
    Select:  Repar the iPhoto Library Database
    Click Rebuild.

  • How to find the 1st sunday in a month

    v_end := '01-nov-' || in_year;
    v_sql_text := 'select next_day('''||v_end||''',''sunday'')+7 from dual';
    this works except that nov 1st is a sunday. better idea?

    Warren, besides being a big overkill (comparing to NEXT_DATE solution), it is, same as NEXT_DAY solution, NLS dependent. Assume you have a client in Germany:
    SQL> alter session set nls_date_language=german;
    Session altered.
    SQL> select next_day(sysdate,'SUNDAY') from dual;
    select next_day(sysdate,'SUNDAY') from dual
    ERROR at line 1:
    ORA-01846: not a valid day of the week
    SQL> NLS independent solution I am aware of is based on Julian date 1 being Tuesday and therefore Julian date 6 being SUnday:
    SQL> select to_char(to_date('1','J'),'Day') from dual;
    TO_CHAR(T
    Tuesday
    SQL> select to_char(to_date('6','J'),'Day') from dual;
    TO_CHAR(T
    Sunday
    SQL> Therefore, NLS independent first Sunday of the month is:
    SQL> alter session set nls_date_format='FMDay, Month DD YYYY';
    Session altered.
    SQL> alter session set nls_date_language=american;
    Session altered.
    SQL> SELECT NEXT_DAY(
      2                  TRUNC(SYSDATE, 'MM') - 1,
      3                  to_char(to_date('6','J'),'Day')
      4                 )
      5    FROM dual
      6  /
    NEXT_DAY(TRUNC(SYSDATE,'MM')
    Sunday, February 4 2007
    SQL> alter session set nls_date_language=german;
    Session altered.
    SQL> SELECT NEXT_DAY(
      2                  TRUNC(SYSDATE, 'MM') - 1,
      3                  to_char(to_date('6','J'),'Day')
      4                 )
      5    FROM dual
      6  /
    NEXT_DAY(TRUNC(SYSDATE,'MM')-
    Sonntag, Februar 4 2007
    SQL> alter session set nls_date_language=french;
    Session altered.
    SQL> SELECT NEXT_DAY(
      2                  TRUNC(SYSDATE, 'MM') - 1,
      3                  to_char(to_date('6','J'),'Day')
      4                 )
      5    FROM dual
      6  /
    NEXT_DAY(TRUNC(SYSDATE,'MM'
    Dimanche, Février 4 2007
    SQL> SY.

  • How to find all solutions for reordering of vector

    hello everyone
    -I have problem in finding all possible solutions for reordering of vector.
    -I have vector named (vect_temp) and I want to find all possible reordering of this vector.
    -I have function named Min_diff(vect_temp,next_point) works as follows : I should gave it an element (next_point) in the vector (vect_temp) and it must generate the vector (vect_diff) that contains all possible elements next elements.
    -The function nex_min(vect_temp,next_point) works as follows : I should gave it an element (next_point) in the vector (vect_temp) and it must generate the vector (vect_min) that contains all possible elements next elements.
    -reordering critriea:
    -Min_diff(vect_temp,next_point) and nex_min(vect_temp,next_point) and (next_point) in this first iteration is equal to any selected element in the (vect_temp). after calling the functions, if element in the (vect_diff) is equal to the element in ( vect_min) then add this element into the ordered set [ vec_ordering] and call functions Min_diff(vect_temp,next_point) and nex_min(vect_temp,next_point) again , next_point now is the equal to the element that we have been added in the previous step into the ordered set [ vec_ordering] and repeat this process until all elements in (vect_temp) are ordered according to this criteria.
    - I'm able to do reordering according to the cirtira above and find one solution. but the problem is that if (vect_diff) contains many elements that equal to many elements in ( vect_min), in this case I need to do reordering for the first equal element and this will be one solution and then find reordering for the next equal element and so on.
    let's consider this example:
    - let (vect_temp) contains element [5,9,7,3,1]
    - for the firs iteration let the next_point equal to 7
    - after calling function Min_diff(vect_temp,next_point), then (vect_diff) will contain [ 5,9,3]
    - after calling function nex_min(vect_temp,next_point), then ( vect_min) will contain [ 5,9]
    so for now (vect_diff) and ( vect_min) will have two equal elements.
    - the first solution must be that fist take the first equal element and do reordering such that ordered set [ vec_ordering] will equal to [7,5] then call functions Min_diff(vect_temp,next_point), and nex_min(vect_temp,next_point) again. the( next_point) in this iteration is qual to 5, these funtions will find next elements, let's consider that (vect_diff) and ( vect_min) will have equal element [3] then add this element to the ordered set [ vec_ordering] and repeat calling functions util all elments in (vect_temp) are added to the ordered set [ vec_ordering]. This will be one solution. now the second solution will be is to take second equal elment [9] instead of [5] and continue calling functions and finding ordered list.
    so that each time vect_diff and vect_min will have many equal elements, then do reordering for first equal element this is one solution and then do reordering for the second equal element and so on.
    -my code that can only find one solution that takes only first equal element in (vect_diff) and ( vect_min) and continue ordering is below
    for (int y = 0; y < vect_temp.size(); y++) {
         Min_diff(vect_temp);
         nex_min(vect_temp, next_point);
        for (int i = 0; i < vect_diff.size(); i++) {
         String element_min = vect_diff.get(i).toString();
         if (vect_min.contains(element_min)) {
           vec_ordering.add(element_min);
         _2nd_min_element = element_min;
          vec_temp.removeElement(next_point);
          next_point = _2nd_min_element;
          i = vect_diff.size();
         }// end if condition
        } // end for (i)loop
    }// end for (y) loop
    I hope that someone can answer me how to find all posssible reordering set it is urgent pleasssssse

    DarrylBurke wrote:
    Two months on and you still haven't done your own homework?
    [http://forums.sun.com/thread.jspa?threadID=5423090]
    dbWell, nobody has given the answer yet, so how can (s)he?

  • Dates for Sunday & Saturday in Month

    I want single query that shows dates of Sunday $ Saturday
    of perticular month.
    so please help me.

    def MONTH=JUL
    def YEAR=2004
    select ZDATE, to_char(ZDATE,'DAY') ZDAY
      from
       (select
              to_date('01-' || '&MONTH' || '&YEAR' ,'DD-MON-YYYY') ZDATE from dual
        UNION ALL
              (select to_date('01-' || '&MONTH' || '&YEAR' ,'DD-MON-YYYY') + N
                  from (select rownum N
                          from all_objects
                         where rownum <= 30
      where
             rtrim(to_char(ZDATE,'DAY')) in ('SATURDAY', 'SUNDAY')
        and  to_char(ZDATE,'MON') = '&MONTH'
    order by
        ZDATE
    03.07.2004 SATURDAY                   
    04.07.2004 SUNDAY                     
    10.07.2004 SATURDAY                   
    11.07.2004 SUNDAY                     
    17.07.2004 SATURDAY                   
    18.07.2004 SUNDAY                     
    24.07.2004 SATURDAY                   
    25.07.2004 SUNDAY                     
    31.07.2004 SATURDAY                   

  • Finding all albums where a master is used

    I lost several hardrives containing my original iphoto libraries that were the original referenced files from within Aperture, one I first set up Aperture years ago. At that time I "referenced" the files rather than including them within Aperture. Fortunately I also had a 3rd copy of all the source images that were input to iPhoto, saved by year/month (there's a lesson!). So I am now busy re-connecting 1000's of Aperture referenced images to the actual file each is to reference. One situation I've discovered is that there are times when I want to know in which albums an image, from a project file, is used. I could benefit from "discover albums" menu item to show me these albums - or a field in the meta data of an image that documents such information automatically when a master image (whether referenced or stored in Aperture) is included in an albumn. Neither, of course, exist (are you listening, Apple?)
    Is there a tool that can help me figure this out - in which albums an image, from a project file, is used - without having to manually check all possible albums?

    I know. But it's like asking what's the point in being able to search for all photos shot at f8. The answer is that I need to find them. If you need to find all the albums with a particular photo, then that need is the point of being able to do so. People have needs depending on their workflow. I've often needed to find all albums containing a particular photo, to see when it was exported, or printed for example, which I always keep track of using albums. Just one example, but I hardly see the point in asking why someone would want a feature when it's perfectly clear in the original post. Sorry, but I just don't see the poiunt of your question.

  • I have a ipod 2g and i cannot find all the apps like VLC media player

    i have a ipod 2g and i cannot find all the apps like VLC media player

    What do you mean? Find the Apps in the App Store or in your iPod homescreen?
    Please note that VLC was removed from the App Store a couple of month ago.

  • Finding all Calendar Events

    Hi
    I need to find all events in a calendar. Using search for say the Planning Calendar only returns Planning in the event name.
    Making only the Planning Calendar visible means I seem to have to trawl back month by month to find them. Not a great solution as I've just brought about 10 years history over from Palm Desktop (aka Claris Organizer.
    Can anyone point me to some sort of advanced search ?
    Also having found them is there a way mass reallocate them to a different calendar ?
    Many thanks
    Eric
    G5 at last Mac OS X (10.4.6)

    Yay. I sussed it.
    Open the Search Result window.
    Tick the calendar in question with others unticked and all its events display.
    Shift click to select multiple events.
    Right click (whoops Ctrl Click) and the context menu allows re-allocation to a different calendar. Cool
    On to the nextissue

  • Is there a fix for iTunes Artwork screensaver finding ALL artwork

    The iTunes screensaver is not finding all the artwork that iTunes has associated with albums. It's only finding cover art that I've manually inserted or paid for from the iTunes music store. I've ready a number of posts from the past month with people experiencing the same issue. Has anyone figured out a way to force the screensaver to look in the right place for all album artwork saved on the cpu? Or is this a lost cause?
    Thanks

    The issue here is that the iTunes Artwork screen saver only looks for artwork embedded in tracks and not in the new artwork database provided by iTunes 7. The only solution for this problem currently available is to embed the tracks with the downloaded iTunes 7 artwork.
    There is an apple script that will do it for you here
    http://www.dougscripts.com/itunes/scripts/scripts13.php?page=1#embedart
    Simply select all tracks and run the script. It will figure out which files need embedded artwork and leave the rest alone.
    After doing that the screen saver will load all of your artwork.

  • Find All Occurrences always fails within loop

    Dear forumers,
    There's this strange problem that requires a fix.
    Finding all occurences of '#' works fine here:-
    REPORT  zz_test.
    DATA: lv_text TYPE string,
          ls_result TYPE match_result,
          et_release type table of yytc_release,
          lt_result  TYPE match_result_tab.
    lv_text = '"RFC-1234#Create ""Payroll"" under NL directory"'.
      FIND ALL OCCURRENCES OF REGEX '#'
                IN lv_text
                RESULTS lt_result IGNORING CASE IN CHARACTER MODE.
      IF sy-subrc = 0.   " SY-SUBRC is always 0
        READ TABLE lt_result INTO ls_result INDEX 1.
        WRITE :'Offset: ' .
        WRITE: ls_result-offset .
        WRITE: lv_text+00(ls_result-offset).
      ENDIF.
    But it always fails here, within a loop at an internal table:-
    SELECT * .... INTO TABLE it_jira ...
    LOOP AT it_jira ASSIGNING <jira>.
      <release>-summary = <jira>-summary.
      IF <release>-type CS 'Subtask'.
        " <release>-summary is of data type CHAR255
        PERFORM get_subtask USING <release>-summary.  
      ENDIF.
    ENDLOOP.
    FORM get_subtask  USING    pv_summary TYPE yytc_release-summary.
      DATA:
        lv_string  TYPE char255,
        lv_final   TYPE char255,
        lv_summary TYPE string,
        lv_strlen  TYPE i,
        lt_result  TYPE match_result_tab.
      lv_string = pv_summary.     " LV_STRING = '"RFC-1234#Create ""Payroll"" under NL directory"''
      CONDENSE lv_string.
      lv_strlen = STRLEN( lv_string ).
      lv_strlen = lv_strlen - 1.
      IF lv_string+0(1) = '"' AND lv_string+lv_strlen(1) = '"'.
        lv_strlen = lv_strlen - 1.
        WRITE lv_string+1(lv_strlen) TO lv_final+1(254).
      ENDIF.
      lv_summary = lv_final.
    "  FIND ALL OCCURRENCES OF '#'
    "      IN lv_summary
    "    RESULTS lt_result IGNORING CASE.   * SY-SUBRC is always 4 here too
      FIND ALL OCCURRENCES OF REGEX '#'
          IN lv_summary
        RESULTS lt_result IGNORING CASE IN CHARACTER MODE.
      IF sy-subrc = 0.    " SY-SUBRC is always 4 here - why?!  :(
      ENDIF.
      CLEAR: lv_string,
             lt_result.
    ENDFORM.                    " GET_SUBTASK
    Only when the string LV_SUMMARY is edited from within the debugger (add space to the string prefix, etc), the SY-SUBRC will be 0 and there'll be data found in LT_RESULT.
    How can I resolve this issue? Please do help. Thanks.

    I think the subtle difference is that in your first example the character is actually '#' whereas in the second example it is actually another (unprintable)value such-as line-feed and only APPEARS to be '#'.
    You must find out what the value in question is(will it always be the same value?) and then replace that instead of '#'.

  • How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them.

    How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them before updating.

    Thanks. This seems to have worked easily.

  • My calendar on my iPhone 4 erases all data over a month old except for recurring events.  How Do I get it to keep the info and not erase calendar events?

    My calendar on my iPhone 4 erases all data over a month old except for recurring events.  How Do I get it to keep the info and not erase calendar events?

    Settings>Mail, Contacts, Calendars>Calendars>Sync>All Events.
    Note: If you're using a work Exchange account, the administrator my have restricted your options for this setting.

Maybe you are looking for