Select for week numbers in the month

Hello

I have a table with columns for the year and month, and select the number of the week for this month. For example:

Where:
10/2008
Result:
40 (01.10 - 05.10)
41 (06.10 - 13.10)
42 (13.10 - 19.10)
43 (20.10 - 26.10)
44 (27.10 - 31.10)

Is this possible?

Thanks in advance,

Tobias

You have not specified exactly what is the logic behind the exit that you showed that they do not incemements 7 days, but here's a starter for you to work on...

SQL> ed
Wrote file afiedt.buf

  1  WITH mydate as (select '10/2008' as dt from dual)
  2  -- end of test data
  3  select to_char(to_date(dt,'MM/YYYY')+(7*rn),'IW') as wk, to_date(dt,'MM/YYYY')+(7*rn) as dt
  4  from mydate, (select rownum-1 rn from dual connect by rownum <= 5)
  5* where to_char(to_date(dt,'MM/YYYY')+(7*rn),'MM/YYYY') = mydate.dt
SQL> /

WK DT
-- ---------
40 01-OCT-08
41 08-OCT-08
42 15-OCT-08
43 22-OCT-08
44 29-OCT-08

SQL>

Tags: Database

Similar Questions

  • Scheduler - schedule for some weekends of the month

    Hello world

    I have a small question on the Scheduler.  There have been a few times I want to plan things for some weekend... for example, planning a reboot every third Sunday of the month.  I don't know if it's possible with the planner of the way it is currently set up, but maybe I'm just completely overlooking something.  It seems to me that I have to manually enter these dates.

    I would like to know if anyone has any ideas.

    Thank you!

    Hey goody,.

    I only use the Scheduler (in the left pane) if I want to program to fix times, for example once a week, each time nd so on.

    For all other purposes, I use auto programming workflow. This means a workflow that is itself on common language runtime scheduling.

    Just call your workflow in itself as a regular workflow. Before calling calc planning date with your algorithm (for example every 3rd Sunday).

    After this date, you will get the scheduleTask. Here you can also set the Boolean value for a restart in the past.

    Under the Goody3335 of workflow in the form of schema:

    Annex Calc might look like this for all the 3rd Sunday

    workflowScheduleDate = new Date(); //this is now
    if (workflowScheduleDate.getMonth() < 11) {workflowScheduleDate.setMonth(workflowScheduleDate.getMonth() + 1);}
    else {workflowScheduleDate.setMonth(0);}
    workflowScheduleDate.setHours(12);
    workflowScheduleDate.setMinutes(0);
    workflowScheduleDate.setSeconds(0);
    workflowScheduleDate.setDate(1);
    if (workflowScheduleDate.getDay() > 0) {workflowScheduleDate.setDate(22 - workflowScheduleDate.getDay());}
    else {workflowScheduleDate.setDate(15);}
    

    You can run this workflow to start whenever you want. He will then see next month by adding a month or go back to 0.

    setDate sets the calendar on the first day in this new month (now the date is the 1st of the new month and the time is set to vCO, 12:00 local time = GMT + Offset)

    From there we can calc the 3rd Sunday: 22-DayOfWeek is the 3rd Sunday, except months begins on Sunday, is 15.

    In the end scheduleDate ist 3rd Sunday at month 12:00

    Kind regards, Andreas

  • Select SQL - last day of the month, a year from now

    Hello
    How do we get the last day of the month, a year from now.

    For example-sysdate-12/2/2009
    Result - 31/12/2009

    Thank you

    Hello

    SELECT  LAST_DAY ( ADD_MONTHS ( SYSDATE
                                  , 12
                )           )
    FROM    dual;
    

    Remember, all DATEs, including the results of this query, include the hours minutes and seconds.
    The hours, the minutes and the seconds returned by the above expression are the same as SYSDATE: If you run it at 15:43:30 today, it returns 15:43:30 on December 31, 2010. This can be important if you want to use an expression like this as the cut-off point in a WHERE clause.

  • Phone Smartphone blackBerry adds + for some numbers in the contact list

    Phone adds the numbers has + to all of my contacts list that start with 571, making it prohibitive and international calls. When I enter the number directly, I can call, but not if bring it to the top of the list of contacts

    Hi and welcome to the forums!

    I think that you need to check that your default country code and area code are entered correctly. Make sure that you do not use a prefix of National appeal.

    Thank you

    Bifocals

    For 8520 user manual - smart dial

    'Set the default country code and area code.
    1. in the phone application, press the Menu key.
    2. click on Options.
    3. click on smart dial.
    4. set the country Code and area Code fields.
    5. in the National number field, set the default length for phone numbers in your country.
    6. press the Menu key.
    7. click on save.
    Note: When you calculate the default length for phone numbers, include your area code and local number, but do not include your country
    code or the national direct dialing prefix. »

  • Looking for an explanation behind the monthly billing.

    I'm looking for an explanation as to why Adobe decided to make their programs require billing monthly one-time vs.

    I'm using CS5 as soon as now (I used it since it was released) and am happy with it - that is, until I got a new MacBook which has the Retina display, which results in image quality and fuzzy interface when editing. (Same applies to Microsoft Office)

    Then... I went to buy the new Photoshop Illustrator, etc., to see that they only let you use it through monthly billing. Why? I'd rather 'clean' my own copy of Adobe to have programs to pay every month as World of Warcraft and other games online.

    Thank you in advance!

    I don't know if it will help with your new Mac, but you can always buy CS6 with a perpetual license Creative Suite 6

    In regards to why... There was a HUGE amount of discussion 2 + years when the switch attempted to Cloud perpetual license

    I have all the links to these old debates, so all I now is that today's software are subscription only

  • Please help with the oracle text and select for each word in the sentence

    Hello

    I have a problem with a query which NEEDS to be done in SQL (not pl/sql in the stored procedure):

    Suppose that a phrase such as "Church of snowboarding."

    Can I divide this by using:
    Select regexp_substr ('church snowboard', ' [^] +', 1, level) word
    of the double
    connect regexp_substr ('church snowboard', ' [^] +', 1, level) is not NULL)

    now I have words 'showboard' and 'Church '.

    So far so good.

    Now I need for each of these words, to create a list of unique IDS collected using text oracle contains the query as follows: (pseudocode)
    for SPLIT.word in "snowboarding", "Church".
    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, SPLIT.word, 1) > 0
    UNION
    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, ' SYN('||)) SPLIT.word: ', GR_THESAURUS)', 1) > 0
    UNION
    SELECT 100 AS NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE NAME LIKE '% "| SPLIT.word | '%'

    so of course I have to untangle this UNION to remove duplicates

    Anyone here sees a way out of my situation? A way to make the loop in a select (use with and such) then
    Just add a select distinct NO_MATRC, NO_NOM_ from)

    I tried, but I'm out of ideas so I thought that some guru here might have the answer ;)

    Thanks in advance for any advice

    See you soon

    You might end up with something like the XML below, ideally as binding in the query.

    SELECT SCORE (1) NIVEAU_RECHERCHE,
    NO_MATRC,
    NO_NOM_
    OF GR_OT_NOM_ASSJT
    WHERE CONTAINS (name, e
    Church of snowboard

    transform ((JETONS, "{", "}", "AND"))
    transform ((JETONS, "{", "}", "OR"))
    turn ((JETONS, «SYN (",", GR_THESAURUS) ', 'AND'))
    turn ((JETONS, «SYN (",", GR_THESAURUS) ', 'GOLD'))
    transform ((JETONS, «?)) {","} "," AND"))/seq >
    transform ((JETONS, «?)) {","} "," GOLD"))/seq >



    (1) > 0

  • PLSQL Funciton in a query SELECT for a region at the APEX

    Hello, I'm developing a SQL report based on a SELECT query that uses a plsql function.

    However, the PLSQL function returns a numeric value and, in addition, it also has an out parameter.

    How to display this on the APEX report parameter value?

    Thank you
    R

    Hello

    FWIW, you can write this to query the report source

    declare
    qry varchar2(32000);
    num number;
    begin
    num := qry_function(qry);
    return qry;
    end;
    

    CITY

  • How to set the {} num.currency such way that it will display "-" sign for negative numbers instead of "()".

    Hi people from Adobe,.

    I am working on a form of invoice of Adobe, where currency a few fields may show as "-" if it is the negative number.

    I use display model num.currency {}, but its poster ($1,234,567.89), I want to display in the form $-1,234,567.89

    Is someone can you please let me know how to achieve this.

    2-25-2016 1-16-10 PM.jpg

    2-25-2016 1-27-20 PM.jpg

    Hello

    I wondered if it would be that simple.  It seems that the United States and Hong Kong are the only ones who use the media for negative numbers.  The Australian currency displayed as you wish.  Maybe you can go into the XML Source and change the line $z, zz9.99 | () $z, zz9.99) $z , zz9.99.  This is how the Australian looks... would need a few tests well.

    Or maybe you can have the hidden decimal field and display a text field with a calculation as DecimalField.formattedValue.replace(/[()]/g,"");. " Do you need to align the decimal points?

    Bruce

  • How to give the right to select for all objects of schema?

    Hello

    We have a lot of users and schemas.
    A user wants to execute 'select' for all tables in the other schema.

    For example: TEST user wishes to select the objects to TEST2. Test2 have hundreds of tables, TEST user cannot select other schema objects, so I don't want to give SELECT ANY TABLE privileges.

    How can do this at once? is it possible to give all the objects schema once subsidies?
    DB versin. 9.2.0.8

    greetings and thanks

    No, there are no subsidies. You must use hundreds of statements of grant.

    However, you can use dynamic SQL to do this automatically, i.e.

    CREATE ROLE test2_select;
    
    BEGIN
      FOR x IN (SELECT * FROM dba_tables WHERE owner='TEST2')
      LOOP
        EXECUTE IMMEDIATE 'GRANT SELECT ON test2.' || x.table_name || ' TO test2_select';
      END LOOP;
    END:
    /
    
    GRANT test2_select TO test;
    

    Justin

  • Week numbers calendar ISO 8601 of iOS?

    When I turn on week numbers in the calendar and Mac OSX calendar iOS, a week number is displayed for each week in the calendar.

    However, I noticed that the week of December 28, 2015 was shown that week 1 of 2016, but the ISO 8601 standard shows that this should be considered in week 53 of 2015 and the week of January 4, 2016 should be 1 week from 2016.

    https://en.Wikipedia.org/wiki/ISO_8601

    After further investigation, I could solve the problem on Mac OSX (El Capitan 10.11.2) by changing the system preferences / language and region, to the first set of "Calendar" "ISO 8601", then make sure that "first day of the week" is "Monday".» Then, exit the calendar app and relaunch it. Fixed!

    However, I was not able to find a way to solve this problem on my iPhone 6 more (iOS 9.2). Under settings / general / language and region / calendar - the only choices are Gregorian, Japanese and Buddhist.

    Y at - it somewhere to another configuration ISO 8601 in iOS?

    In settings-> General-> language & region, select the United Kingdom in your area. I don't know what are the other results, but it sets the number of date for me (even though I live in the United States)

  • Simple collection of the months component (without corresponding calendar?)

    I feel that it can be ridiculously easy to answer...

    I am looking for a component of the months picking it is simply an extension of something that already exists.

    My first instinct was to look at the JXMonthView that is included inside SwingX. Basically, my ideal component would be one that includes only the month part up to the selection page of the JXMonthView component with "traversable' set to true. In other words, a control that allows you to choose a month in the year using a schema of forward/reverse. Unfortunately, I can't find a good way to replace the functionality of the class such that only the top header is included.

    I tried to get into the guts of the code, but it was like the best thing to do was to replace the layoutContainer inside BasicMonthViewUI function. Then I realized that this feature is part of a private class. I missed a great way to hide just that little of the Panel? I also considered replacing the functions of the painting, but my fear is that the component request too much space because it's just not 'paint' the month but still allocates space for this.

    I think that, perhaps, a self-made simple control may be the best solution? I'm just trying to stay away from possible much custom work I hope to make the control as portable as possible between platforms.

    Thank you!

    aardvarkk wrote:
    I'm looking for what you might call a "horizontal spinner" or scroll bar, in which you have a front and back button on each side of months he throws back a month and back. Also it should technically go back into previous years and to enter in the new.

    Here is something of a JSlider in months and JButtons in the years. Because I'm not that familiar with Date/calendar, there is probably a better way to extract the necessary information (exercise for the OP), but this comes from the Swing stuff demos:

    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    
    import javax.swing.*;
    import javax.swing.event.*;
    
    public class MonthScroller extends JPanel
    {
      String[] months;
      JSlider slider;
      JButton btnPrevious, btnNext;
      JLabel displayMonth, displayYear;
      int month, year;
    
      public MonthScroller()
      {
        months = Arrays.copyOf(
            DateFormatSymbols.getInstance().getShortMonths(), 12);
        month = Calendar.getInstance().get(Calendar.MONTH);
        year = Calendar.getInstance().get(Calendar.YEAR);
    
        displayMonth = new JLabel(months[month]);
        displayYear = new JLabel(String.valueOf(year));
    
        slider = new JSlider(0, 11, month);
        slider.setMinorTickSpacing(1);
        slider.setPaintTicks(true);
        slider.setPaintLabels(true);
        slider.addChangeListener(new ChangeListener(){
          public void stateChanged(ChangeEvent e)
          {
            month = slider.getValue();
            displayMonth.setText(months[month]);
          }
        });
    
        btnPrevious = new JButton("<");
        btnPrevious.addActionListener(new YearIncrementer(-1));
        btnNext = new JButton(">");
        btnNext.addActionListener(new YearIncrementer(1));
    
        add(btnPrevious);
        add(slider);
        add(btnNext);
        add(displayMonth);
        add(displayYear);
      }
    
      private static void createAndShowUI()
      {
        JFrame frame = new JFrame("Month Scroller");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new MonthScroller());
        frame.pack();
        frame.setLocationRelativeTo( null );
        frame.setVisible( true );
      }
    
      public static void main(String[] args)
      {
        EventQueue.invokeLater(new Runnable()
        {
          public void run()
          {
            createAndShowUI();
          }
        });
      }
    
      class YearIncrementer implements ActionListener
      {
        int increment;
        YearIncrementer(int increment)
        {
          this.increment = increment;
        }
    
        public void actionPerformed(ActionEvent e)
        {
          year += increment;
          displayYear.setText(String.valueOf(year));
        }
      }
    }
    
  • Months of searching for numbers on the sheet

    Hello all and thanks in advance.

    I have tabs at the top. DATA (sheet 1), JAN (sheet 2), FEB (record 3), etc. until the end of the year.

    Data sheet will be the months on the left now I want care to go to the form to correct month and takes the total of the column relative to the other leaves and place in the correct cell line. (I've been copy paste, but I know there is an easier way to do this, so I turn to the people who know the numbers unlike my lack of knowledge.)

    On the leaves of the month, I would also like to highlight the line that are sat and Sun.

    Thanks again everyone for their help.

    Rich

    In the material master

    Hi, NN,.

    You will have a Table for each month. Each Table must have a different name. Your summary table lists more than 12 months, then I would say the table name from each month is named with the name of the month AND the year.

    The monthly tables may appear on separate sheets, or the same sheet. The key, as far as the formulae are concerned, is that each Table can be identified by its name.

    The following example includes only the table for April 2016, named "APR 2016", I assumed that the total line will be row 33 on each table of data collection, but wrote the formula to allow the placement of the line totals in other places. The lines for most of the actual days have been hidden and has not been designated, as these labels have no role in the operation of the formula.

    The TOTALS is defined as a footer line. The formula, in the columns showing a value is SUM (a) where 'a' is the letter of the column to be added. (The two values of zero have been entered manually for example).

    The table has a unique formula, entered in cell B3 and filled with right and until the last line for which there is a Table whose name corresponds to the label in column A. For example, the formula has been met only 3 online.

    B3: = INDEX (APRIL 2016: $A$ 1: $ 33, MATCH $N ("TOTALS", APRIL 2016: $A, 0), GAME ($ 1 B, APRIL 2016: $1: $1.0),)

    Syntax:

    INSTRUCTION (range,-l'index of the line, column-index, index of the surface)

    range: all of the cells in the source table

    the index of the line: the number of the start line to get the value. This is provided by the first statement of the GAME.

    the index of the column: the number of the column from which to get the value. This is provided by the second statement to MATCH.

    the index of the surface: omis. By default, 1. There is only 1 area of application of this INDEX, all of the source table.

    MATCH (image search-search for, - where - method)

    EQUIV function returns the position in the list of the search for value.

    First case:

    search for: TOTALS text

    search - where: column A of table source

    method): 0 means finding the exact value.

    Second case:

    search for: the text contained in the cell of line 1 of the specified column. That form is completed on the right, the increments of the column by one for each stage.

    search - where: line 1 of table source

    method): 0 means finding the exact value.

    The formula should be changed for each new line. Three references to "APR 2016" should be changed to match the name of the table to collect this row grand totals. Once edited in column A, the formula can be filled right and automatically adapts to his new position.

    Note: The duration value in column F of the table of the month wouldn't transfer and keep the same formula in column C of the summary table. Any attempt to restore the format to match your example resulted in a triangle of error.

    Kind regards

    Barry

  • Recurring appointment Set for certain days of the week each month in the calendar on Surface RT?

    It seems to me that this is not possible, but is there a way I can put a recurring appointment for a certain day of the week of each month in the calendar on the Surface RT? For example, a meeting Tuesday on two or one excursion each fourth Sunday?  I know that this is possible in Outlook on a PC and I would like to do it on the Surface RT as well.  Most of my recurring appointments are of this type.  When I recur every month on the Surface, it just sets it for the same date (for example the 12th of each month) instead of the second Tuesday.  Thank you!

    Hi Lisa,

    You were correct when you say that 'it seems to me that's not possible. ' The recurring appointment for some day of the week each month in the calendar on Surface RT cannot be done by date and not day.

    Good day!

  • Select the first 20 days of the month for a given date

    Hi gurus,

    Please let me know to select the first 20 dates for a date supplied by using a parameter.

    For ex -.

    Suppose I provided a date by using a parameter - January 13, 2012

    The query should return me - 01-Jan-2012, January 2, 2012... January 20, 2012

    or if I get home on 23 March 2012

    The query should return me - 01-Mar-2012, March 2, 2012... 20 March 2012

    Thanks in advance.

    Hello

    Here's one way:

    VARIABLE  target_date     VARCHAR2 (11)
    EXEC     :target_date := '13-Jan-2012';
    
    SELECT      TO_DATE ( SUBSTR (:target_date, 4)
                , 'Mon-YYYY'
               ) + LEVEL - 1     AS a_date
    FROM     dual
    CONNECT BY     LEVEL     <= 20
    ;
    

    Note that this does not take account the part of: target_date that represents the day of the month. When you use TO_DATE without giving a date of the month, it defaults to the 1st of the month.

  • start date for each week of the month

    Dear members

    How can I find double, the start date of each week of the month in a year.
    beginning of the week is the word "Monday".


    year month week day date
    ----------------------------------------------------------------------------------------
    Monday, January 3, 2011 JAN 1, 2011
    2011 2 JAN Monday, January 10, 2011
    Monday, January 17, 2011 January 3, 2011
    JAN 4 2011 on Monday, January 24, 2011
    2011 to January 5 Monday, January 31, 2011


    Thank you

    teefu

    Hello

    You can use this:

    with t as  (select to_date ('01/01/2011', 'DD/MM/YYYY') start_date from dual)
    select  date_calc
    from (
            select  start_date,
                    (level-1)*7+trunc (start_date , 'D')+1   as date_calc
            from t
            connect by level <=53)
    where trunc(date_calc,'YYYY')=trunc(start_date,'YYYY') ;
    

    Kind regards
    Sylvie

Maybe you are looking for

  • HP ENVY 14-1000 CTO Notebook: fact ENVY 14 t - 1000 CTO (2010) have UEFI firmware?

    This model (from worms 2010) he UEFI firmware? I don't see any indication that it made, with Windows, information system, the Mode "BIOS" is "legacy". I do not see switches to BIOS legacy in BIOS emulation is set up. But this would be the case of par

  • Windows Media Center TV Guide ads

    I'm in the United Kingdom. TV Guide lists seem to have stopped updating. My listings end tomorrow morning (1 January 2013). The company that generates the list of the UK said that updates have been transferred to Microsoft, and there should be 15 day

  • Hidden on BlackBerry 8350i v4.6.1.112 menu

    When the user clicks the menu button, the menu is not displayed when the use of canvas or GameCanvas! I think that it is displayed behind the canvas. It is shown that when we use a Screen object! We have a J2ME application that works with more than 4

  • D4160 arrow flashing light yellow

    I tried to solve this 'problem' for a while now. There is that nothing jammed in the printer, I put in the new document, taken out and put back in ink, removed the back and back and shut down several times. I downloaded the 'Diagnostics' thing and he

  • Hey Adobe, WTH, do test u your shit on a Macbook?

    So, I have a Macbook.  I used Photoshop CC 2015 on this for almost 4 months now without any problem.  So today, I see an update.  As I did the update it says it will copy my preferences in this new version of CC 2015.5 swank and remove the old versio