Generate the dates of January 1, 2005 to December 31, 2010

Hi I want to write a simple query to list all the dates from January 2005 to December 2010 double. I tried a lot of things, but could not do. Please, help me in this one.
SELECT      TO_DATE(:startdate,'MM/DD/YYYY')+(LEVEL-1) AS DATES
FROM     DUAL
CONNECT BY LEVEL <= TO_DATE(:enddate,'MM/DD/YYYY')-TO_DATE(:startdate,'MM/DD/YYYY')+1
/

Results of the sample:

SQL > var startdate  VARCHAR2(25);
SQL > var enddate    VARCHAR2(25);
SQL >
SQL > exec :startdate :='01/01/2005';

PL/SQL procedure successfully completed.

SQL > exec :enddate :='12/31/2010';

PL/SQL procedure successfully completed.

SQL > SELECT         TO_DATE(:startdate,'MM/DD/YYYY')+LEVEL AS DATES
  2  FROM       DUAL
  3  CONNECT BY LEVEL <= TO_DATE(:enddate,'MM/DD/YYYY')-TO_DATE(:startdate,'MM/DD/YYYY')+1
  4  /

DATES
-------------------
01/01/2005 00:00:00
01/02/2005 00:00:00
01/03/2005 00:00:00
01/04/2005 00:00:00
01/05/2005 00:00:00
.
.
.

Tags: Database

Similar Questions

  • I changed the date to January 1, 1970 and I rebooted, but it does not work, what can I do about it?

    Answer me please

    Why change the date of 1970?

    Your iPhone becomes a brick. You can try using DFU mode, although there is no guarantee that it will work.

    If you have changed the date of May 1970 or earlier and cannot restart your iPhone, iPad or iPod touch - Apple Support

    Contact Apple support and ask for help.

  • How to generate the dates in order through functions

    first to see the code example
    create or replace function FNC_GET_DATE(p_businessdate varchar2) return date
    as
    v_date date;
    begin
    
    v_Date := to_date(p_businessdate,'mm/dd/yyyy') +10;
    
    return v_date;
    end;
    Now I mean this function in a loop for N times and the first output of the function must be the entrance for the second call

    Assuming that the initial value of p_businessdate be 01/01/2012 the output of the function should be 11/01/2012.

    Now exit 11/01/2012 must be sent as input for the FNC_GET_DATE function, then the output should be 21/01/2012.

    Now exit 21/01/2012 must be sent as input for the FNC_GET_DATE function, then the output should be 31/01/2012.

    Assuming that the number of iterations to 4 outputs (here the value of N) should be something like this:
    01/01/2012
    01/11/2012
    01/21/2012
    01/31/2012
    For this we need a function that has p_busdate and no_of_itereations as input parameter and the retrun type can be a sysrefcursor as shown below, once more:


    01/01/2012
    11/01/2012
    21/01/2012
    31/01/2012

    Please notify.

    Here's a basic idea.

    I used a nested function to simulate the 'other' function, you need to call. I also didn't care to do things like manipulate strings and convert to date, but you get the idea.

    create or replace function f_get_some_dates
    (
          p_starting_date   date
       ,  p_how_many_dates  number
    )
    return sys_refcursor
    as
       l_date_list    sys.odcidatelist  default sys.odcidatelist();
       l_current_date date  := p_starting_date;
       l_ref_cursor   sys_refcursor;
    
       function f_add_days
       (
          p_date   date
       )
       return date
       is
       begin
          return p_date + 10;
       end f_add_days;
    begin
    
       for loop_idx in 1 .. p_how_many_dates
       loop
          l_current_date := f_add_days(l_current_date);
          l_date_list.extend;
          l_date_list(l_date_list.count)   := l_current_date;
       end loop;
    
       open l_ref_cursor for
       select *
       from table(cast(l_date_list as sys.odcidatelist))
       order by column_value asc;
    
       return l_ref_cursor;
    
    end f_get_some_dates;
    /
    
    ME_TUBBZ?variable rc refcursor;
    ME_TUBBZ?exec :rc := f_get_some_dates(trunc(sysdate, 'dd'), 2);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01
    ME_TUBBZ?print :rc
    
    COLUMN_VALUE
    --------------------
    08-JUL-2012 00 00:00
    18-JUL-2012 00 00:00
    
    2 rows selected.
    
    Elapsed: 00:00:00.00
    ME_TUBBZ?exec :rc := f_get_some_dates(trunc(sysdate, 'dd'), 4);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    ME_TUBBZ?print :rc
    
    COLUMN_VALUE
    --------------------
    08-JUL-2012 00 00:00
    18-JUL-2012 00 00:00
    28-JUL-2012 00 00:00
    07-AUG-2012 00 00:00
    
    4 rows selected.
    
    Elapsed: 00:00:00.00
    ME_TUBBZ?
    

    See you soon,.

  • Auto generate the data field item2

    I have fields in my application

    If I select the Item1 number it will automatically give me the value in Item2 refers to this item1 can you please answer on that

    Hello

    It is necessary to a column of data for the updated item in the record.

    As long as you set the value everytime the page loads, you can change the value of the Source used for: only when the current value in session state is zero

    Then create a calculation for your page, your page that runs "before the header" that executes your SQL code

    Andy

  • How to change the DML processes in Assistant APEX generated the data entry form

    I created a standard form of the APEX on a table using the wizard of the APEX. Now, I added a new element to the page. How to change the DML insert statement to take care of this new item? any ideas are appreciated.

    Thank you
    Surya

    For the new item, just keep the type of Source as the "column of the database" and give the name of the column (the column for a new item name) under the "Source value or expression.

    See you soon,.
    Hari

  • Photos shows a date incorrect (January 1, 1970), even if the date in the Finder is correct

    Recently, when I import pictures I took on my phone Android in Photos, they all indicate the date created January 1, 1970 (which, in my opinion, happens when there is no data to date) even if the described Finder properly the date of creation.

    It also happened when I tried to import into iPhoto. The only exceptions are the videos and photos, that I have edited in my Android phone before copying them on my computer. I'm not sure if the problem lies with Photos or my phone, but apparently from the Finder Gets the correct date information should - not be possible for Photos as well?

    Date Finder, do you mean the creation of file? Pictures which have a date in the form of data in the file? It's different to the creation date of the file that you usually see in the finder. Same place as the manufacturer of location data and camera will be stored.

    Would the image Photo app is not looking at the creation Date of the file, but the Date field for Photo taking

  • Is it possible to fix your iPhone 6 after setting the date and time to January 1, 1970?

    I saw something on the internet that says your iPhone 6 would do something cool if the date to January 1, 1970. I did it and my phone does not now and is constantly reset. If anyone here can help me, please let me know.

    Thank you!

    Hi, try a DFU restore.

    Someone has solved the problem by removing the sim card, I have not tried, but you can give it a shot.

    The last solution is to let the battery discharge, but I do not recommend this.

    In any case the best solution is to make an appointment with the Apple Genius Bar, you'll probably helped.

  • It is April 2013, so why the date change to January 2002 it is restarted each time?

    Why my computer keep changing the date of January 2002 it is restarted each time?   Several times I manually put it in April 2013 with time zone (GMT-05:00) Eastern time (United States and Canada &).  But on reboot it goes back to the year 2002.  I have Windows XP Home edition.

    Oh no! I had not thought of that. If the default BIOS is happened to run on now.  Once I replaced the c - mos battery should I search and download a BIOS update?

    More modern computers don't need a battery to maintain their settings or be reconfigured when the battery is changed.  That's why this battery is more precisely called the RTC (Real Time Clock) battery.

    It is sometimes known as the CMOS battery because it is the type of memory (Complementary Metal Oxide Semiconductor) in what settings that the BIOS needs used to be saved.  Nowadays, these settings are saved in another type of 'no volatile random access memory' (NVRAM memory) that does not need a battery to maintain memory.

    In the old days (maybe also recently when Win95 was running), electronics is not able to detect the type of HDD to use (and possibly other materials) and configurations should be set manually. Because the CMOS memory does need a battery to maintain, when the battery is dead, you need to reset these configurations.

  • How to fill out the Date and time in the OPS page CO

    Hi all

    How to generate the date current system (without using "select sysdate from dual"), in the controller OAF (processRequest) to an OAMessageDateFieldBean page?
    When I use the following code, the month is always displayed in January alone.
    In his display as a page OFA: January 26, 2009 15:46:30
    Using System.out.println: 2009-05-26 15:46:30.0

    Kindkly help me in this regard.

    Code
    OAApplicationModule am = pageContext.getApplicationModule (webBean);
    SimpleDateFormat f = new SimpleDateFormat ("yyyy-mm-dd hh: mm :"); ")
    String dateString = am.getOADBTransaction () .getCurrentDBDate () m:System.NET.SocketAddress.ToString ();

    java.sql.Date sqlDate = new Date (f.parse (dateString) .getTime ());

    DateField OAMessageDateFieldBean =
    (OAMessageDateFieldBean) webBean.findIndexedChildRecursive ("currentDate");
    dateField.setValue (pageContext, sqlDate);

    System.out.println (am.getOADBTransaction () .getCurrentDBDate (). ToString());

    Kind regards
    Joe

    Hey Joe,

    Change the line of code...

    Of

    SimpleDateFormat f = new SimpleDateFormat ("yyyy-mm-dd hh: mm :"); ")

    TO

    SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-DD hh: mm :"); ")

    It will work...

    Thank you
    Anoop

  • Unable to retrieve the data using self join

    I'm trying to find the time required to close a ticket. The ticket goes through different stages: NEW, INPROCESS, CLOSED, REOPENED. If the ticket is reopened so the next step would be INPROCESS and then CLOSED.

    The CC_TICKET_INFO table contains information on the last step of the ticket. Table CC_TICKET_HISTORY contains information on every step of the ticket.

    The challenge here is that if the ticket is reopened so it should be considered as 2 instances instead of 1.

    Trial of stages: NEW-INPROCESS-> CLOSE >

    Second instance of stages: REOPEND -> INPROCESS-> CLOSE.

    Following SQL is to generate the data:

    CREATE TABLE CC_TICKET_INFO

    (

    TICKET_ID VARCHAR2 (20 BYTE) NOT NULL

    TICKET_STATUS VARCHAR2 (60 BYTE)

    , created_date timestamp (6)

    , LAST_CHANGED timestamp (6)

    , ASSIGNED_TO VARCHAR2 (20)

    CONSTRAINT PK_CC_TICKET_INFO PRIMARY KEY

    (

    ticket_id

    )

    )

    CREATE TABLE CC_TICKET_HISTORY

    (

    TICKET_ID VARCHAR2 (20 BYTE) NOT NULL

    TICKET_STATUS VARCHAR2 (60 BYTE)

    , CREATED_DATE TIMESTAMP (6) NOT NULL

    ASSIGNED_TO VARCHAR2 (255 BYTE)

    CREATED_BY VARCHAR2 (60 BYTE)

    CONSTRAINT PK_CC_TICKET_HISTORY PRIMARY KEY

    (

    TICKET_ID

    CREATED_DATE

    )

    )

    insert into cc_ticket_history values ('D21207155', 'NEW', 6/28/2013-17:28:59 ', null, 'jsg - st');

    insert into cc_ticket_history values ('D21207155', 'INPROCESS', 6/28/2013-17:48:19 ', 'ah-eg","ah-eg");

    insert into cc_ticket_history values ('D21207155', 'CLOSED', 6/28/2013 18:54:23 ', 'ah-eg","ah-eg");

    insert into cc_ticket_history values ('D21207155', 'REOPENED', 7/2/2013 19:55:04 ', 'ah-eg","jsg - st");

    insert into cc_ticket_history values ('D21207155', 'INPROCESS', 7/2/2013 20:11:17 ', "sr - eg", "sr - eg");

    insert into cc_ticket_history values ('D21207155', 'CLOSED', 7/2/2013 23:06:16 ', "sr - eg", "sr - eg");

    insert into CC_TICKET_INFO values ('D21207155', 'CLOSED', 6/28/2013-17:28:59 ', ' 02/07/2013-23:06:16 ', "sr - eg");

    ______________________________________________________________________

    I want to find the time difference between 6/28/2013 18:54:23 'and 6/28/2013-17:28:59 ' (first instance)

    and between 23:06:16 7/2/2013 ' and 7/2/2013 19:55:04 "(second instance)

    Is the closest, I make the through this query:

    Select L.ticket_id, L.CREATED_DATE, R.CREATED_DATE as close_date, L.TICKET_STATUS, R.TICKET_STATUS cc_ticket_history cc_ticket_history join RIGHT L R on (L.rowid < R.rowid) where (L.TICKET_STATUS = 'NEW' R.TICKET_STATUS AND 'CLOSED' =) OR (L.TICKET_STATUS = 'REOPENED' AND R.TICKET_STATUS = 'CLOSED');

    Can it be done through SQL?

    Hello

    ORA - aff wrote:

    Etbin thanks for the reply. I think you're closer!

    The first 3 orders insert above form the first instance. The second 3 inserts statements form the second instance.

    Ideally, I'd like the output to something like this (values taken by top of insert statements):

    Ticket_ID STATUS CREATED_DATE CLOSED_DATE TIME_DIFFERENCE

    D21207155 CLOSED ON 28/06/2013 17:28:59 6/28/2013 18:54:23

    D21207155 CLOSED ON 07/02/2013 19:55:04 07/02/2013 23:06:16

    You can do this by using the analytical LAST_VALUE function:

    WITH got_opened_date AS

    (

    SELECT ticket_id, ticket_status, created_date

    LAST_VALUE (CASE

    WHEN ticket_status IN ('NEW', 'REOPENED')

    THEN created_date

    END

    IGNORES NULL VALUES

    ) OVER (PARTITION BY ticket_id

    ORDER BY created_date

    ) AS opened_date

    OF cc_ticket_history

    )

    SELECT ticket_id

    ticket_status AS status

    opened_date AS created_date

    created_date AS closed_date

    NULL AS time_difference

    OF got_opened_date

    WHERE ticket_status = 'CLOSED '.

    ORDER BY ticket_id

    closed_date

    ;

  • Need to find gaps in the data

    Hi all

    I have the following documents:

    -Drop Table
    drop table agreement;
    drop table GRP_INFO;
    -Create table
    create table agreement
    (
    Agreement_Id Number (5),
    Date of Coverage_Effective_Date,
    Date of COVERAGE_termination_date
    );
    Create Table GRP_INFO
    (
    Agreement_Id Number (5),
    Grp_Id Number (5),
    Date of Effective_Date,
    Date TERMINATION_DATE
    );
    ------------

    -Insertion
    Insert into the agreement
    Select 100,'01 JAN - 2013", December 31, 2013"
    From Dual;

    Insert into the agreement
    Select 200,'01 JAN - 2013", December 31, 2013"
    From Dual;

    Insert into the agreement
    Select 300,'01 JAN - 2013", December 31, 2013"
    From Dual;

    Insert into the agreement
    Select 400,'01 JAN - 2013", December 31, 2013"
    From Dual;
    ----------
    Insert into Grp_Info
    Select 100.1, 1 January 2013 ", 31 March 2013"
    Of the double
    UNION ALL
    Select 100.2, April 1, 2013 ", April 2, 2013"
    Of the double
    UNION ALL
    Select 100.3, April 3, 2013 ", April 15, 2013"
    Of the double
    UNION ALL
    Select 100.4, April 3, 2013 ", April 15, 2013"
    Of the double
    UNION ALL
    Select 100.5, 1 June 2013 ", December 31, 2013"
    Of the double
    Union All
    Select 200.6, 1 January 2013 ", April 2, 2013"
    Of the double
    Union All
    Select 200,7, April 3, 2013 ", April 15, 2013"
    Of the double
    Union All
    Select 200,8, April 3, 2013 ", April 15, 2013"
    Of the double
    Union All
    Select 200,9, June 1, 2013 ", November 30, 2013"
    Of the double
    Union All
    Select 300,10, 1 January 2013 ", April 15, 2013"
    Of the double
    Union All
    Select 300,11, April 16, 2013 ", December 31, 2013"
    Of the double
    Union All
    Select 400,12, January 2, 2013 ", December 31, 2013"
    From Dual;

    COMMIT;

    -------------------

    -Queries on the table of the agreement

    Select * agree;

    -Result of the query

    agreement_id coverage_effective_date coverage_termination_date

    100                                         01-JAN-13                                                   31-DEC-13

    200                                         01-JAN-13                                                   31-DEC-13

    300                                         01-JAN-13                                                   31-DEC-13

    400                                         01-JAN-13                                                   31-DEC-13

    -----------------------

    -Queries on grp_info table

    agreement_id grp_id effective_date termination_date

    100                                              1                     01-JAN-13                       31-MAR-13

    100                                              2                     01-APR-13                       02-APR-13

    100                                              3                     03-APR-13                       15-APR-13

    100                                              4                     03-APR-13                       15-APR-13

    100                                              5                     01-JUN-13                        31-DEC-13

    200                                              6                     01-JAN-13                        02-APR-13

    200                                              7                     03-APR-13                        15-APR-13

    200                                              8                     03-APR-13                        15-APR-13

    200                                              9                     01-JUN-13                         30-NOV-13

    300                                              10                   01-JAN-13                         15-APR-13

    300                                              11                   16-APR-13                         31-DEC-13

    400                                              12                   02-JAN-13                          31-DEC-13

    -------------

    -Result

    agreement_id

    100

    200

    400

    ----------------------

    -Logic for the above result

    Each agreement_id have several grp_id and grp_id all or at least one should cover all the period agreement_id for example:

    -Agreement_id 100 a protection from the date is January 1, 2013 and coverage_termination_date is December 31, 2013, and if you look in all the archives against agreement_id 100 so you can find the period from April 16, 2013 until 31 May 2013 are missing so I need this agreement_id.

    -Agreement_id 200 a protection from the date is January 1, 2013 and coverage_termination_date is December 31, 2013, and if you look in all the archives against agreement_id 200 then you can find that the period from December 1, 2013 until 31 December 2013 are missing so I need this agreement_id.

    -Agreement_id 300 a protection from the date is January 1, 2013 and coverage_termination_date is December 31, 2013, and if you look in all the archives against agreement_id 300 then you can find that no period is missing, I don't need this agreement_id.

    -Agreement_id 400 a protection from the date is January 1, 2013 and coverage_termination_date is December 31, 2013, and if you look in all the archives against agreement_id 300 then you can find that the period from January 1, 2013, until January 1, 2013 is missing, so I need this agreement_id.

    --------------

    Please let me know if you have any related questions my script and I really appreciate if someone can give me the solution for this problem.

    Concerning

    Line

    Hello

    Here's one way:

    WITH got_gap AS

    (

    SELECT agreement_id, effective_date, termination_date

    CASE

    WHEN effective_date >

    1 + MAX (termination_date) OVER (PARTITION BY agreement_id

    ORDER BY effective_date

    ROWS BETWEEN UNBOUNDED PRECEDING

    AND 1 PRECEDING

    )

    THEN 1

    Difference in the END as the

    OF grp_info

    )

    SELECT g.agreement_id

    OF got_gap g

    JOIN agreement has ON a.agreement_id = g.agreement_id

    GROUP BY g.agreement_id

    GIVEN the NUMBER (g.gap) > 0

    MIN (g.effective_date) OR > MIN (a.coverage_effective_date)

    OR MAX (g.termination_date)< max="">

    ORDER BY g.agreement_id

    ;

    Output:

    AGREEMENT_ID

    ------------

    100

    200

    400

    Makes no assumptions about effective_date and termination_date, except that effective_date<= termination_date="" on="" each="" row. ="" it's="" okay="" if="" different="" rows="" for="" the="" same="" agreement_id="" overlap,="" or="" if="" one="" encompasses="">

    Do not attempt to insert VARCHAR2 values (like January 1, 2013 "") in the DATE columns.  Use TO_DATE, either DATE literals.

  • find the date and day

    transaction

    ID Grp Loc qty type report_days

    ABC x 21 101 1 4/1/2009
    ABC x 29 101 2 4/1/2009
    ABC x 22 101 3 4/1/2009
    ABC x 45 101 1 15/6 / 2008
    ABC 100 x 102 1 16/11/2008

    I have a table called transaction

    I want to generate a report like this in an another table generatereport

    GenerateReport

    GenerateReport

    ID Grp Loc qty1 2 days report_days

    ABC 101 x 0 0 Sunday, June 1, 2008 adding 7 days
    101          abc          x          0          0          Sunday          ..
    ABC 101 x 45 0 Monday, June 15, 2009
    ABC 101 x 100 0 Sunday, November 16, 2008
    101          abc          x          0          0          Sunday          …
    101 abc x 50 22 Sunday until 01/04/2009 (i.e. ONE year)


    Qty1 Generatereport table column is filled with the sum of the quantity of type 1 + type 2

    column 2 of table Generatereport is filled with the sum of the quantity of type 3

    All day should be Sunday

    and we must go a year back from 01/04/09 and generate the timetable up to 2009-04-01 only for Sundays

    can you help me pls

    Thanks in advance

    Published by: user12093849 on November 13, 2009 04:55

    Published by: user12093849 on November 13, 2009 04:58

    This is the query, I came up with that:

    WITH    transaction_table AS
    (
            SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 21  AS QTY, 1 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
            SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 29  AS QTY, 2 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
            SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 22  AS QTY, 3 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
            SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 45  AS QTY, 1 AS TYPE, TO_DATE('06/15/2008','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
            SELECT  102 AS ID, 'abc' AS GRP, 'x' AS LOC, 100 AS QTY, 1 AS TYPE, TO_DATE('11/16/2008','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL
    )
    -- END TEST DATA
    ,      sunday_date_range AS
    (
            SELECT  NEXT_DAY(TO_DATE(:pStartDate,'MM/DD/YYYY')-1,'SUNDAY') + 7*(LEVEL - 1) AS DT
            FROM    DUAL
            CONNECT BY LEVEL <= (TO_DATE(:pEndDate,'MM/DD/YYYY') - TO_DATE(:pStartDate,'MM/DD/YYYY'))/7 + 1
    )
    SELECT  ID
    ,       GRP
    ,       LOC
    ,       TO_CHAR(DT,'Day DD/MM/YYYY')    AS REPORT_DAYS
    ,       SUM(CASE WHEN TYPE IN (1,2)     THEN QTY ELSE 0 END) AS QTY1
    ,       SUM(CASE WHEN TYPE = 3          THEN QTY ELSE 0 END) AS QTY2
    FROM                    transaction_table       PARTITION BY (ID, GRP, LOC)
    RIGHT OUTER JOIN        sunday_date_range       ON transaction_table.REPORT_DAYS BETWEEN sunday_date_range.DT - 7 + INTERVAL '1' SECOND AND sunday_date_range.DT
    GROUP BY ID
    ,       GRP
    ,       LOC
    ,       DT
    ORDER BY 1, 2, 3
    

    Here's the test scenario:

    SQL> var pStartDate  VARCHAR2(25);
    SQL> exec :pStartDate := '04/01/2008';
    
    PL/SQL procedure successfully completed.
    
    SQL> var pEndDate  VARCHAR2(25);
    SQL> exec :pEndDate := '04/01/2009';
    
    PL/SQL procedure successfully completed.
    
    SQL> WITH    transaction_table AS
      2  (
      3          SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 21  AS QTY, 1 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
      4          SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 29  AS QTY, 2 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
      5          SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 22  AS QTY, 3 AS TYPE, TO_DATE('04/01/2009','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
      6          SELECT  101 AS ID, 'abc' AS GRP, 'x' AS LOC, 45  AS QTY, 1 AS TYPE, TO_DATE('06/15/2008','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL UNION ALL
      7          SELECT  102 AS ID, 'abc' AS GRP, 'x' AS LOC, 100 AS QTY, 1 AS TYPE, TO_DATE('11/16/2008','MM/DD/YYYY') AS REPORT_DAYS FROM DUAL
      8  )
      9  -- END TEST DATA
     10  ,      sunday_date_range AS
     11  (
     12          SELECT  NEXT_DAY(TO_DATE(:pStartDate,'MM/DD/YYYY')-1,'SUNDAY') + 7*(LEVEL - 1) AS DT
     13          FROM    DUAL
     14          CONNECT BY LEVEL <= (TO_DATE(:pEndDate,'MM/DD/YYYY') - TO_DATE(:pStartDate,'MM/DD/YYYY'))/7 + 1
     15  )
     16  SELECT  ID
     17  ,       GRP
     18  ,       LOC
     19  ,       TO_CHAR(DT,'Day DD/MM/YYYY')    AS REPORT_DAYS
     20  ,       SUM(CASE WHEN TYPE IN (1,2)     THEN QTY ELSE 0 END) AS QTY1
     21  ,       SUM(CASE WHEN TYPE = 3          THEN QTY ELSE 0 END) AS QTY2
     22  FROM                    transaction_table       PARTITION BY (ID, GRP, LOC)
     23  RIGHT OUTER JOIN        sunday_date_range       ON transaction_table.REPORT_DAYS BETWEEN sunday_date_range.DT - 7 + INTERVAL '1' SECOND AND sunday_date_range.DT
     24  GROUP BY ID
     25  ,       GRP
     26  ,       LOC
     27  ,       DT
     28  ORDER BY 1, 2, 3
     29  /
    
            ID GRP L REPORT_DAYS                QTY1       QTY2
    ---------- --- - -------------------- ---------- ----------
           101 abc x Sunday    06/04/2008          0          0
           101 abc x Sunday    13/04/2008          0          0
           101 abc x Sunday    20/04/2008          0          0
           101 abc x Sunday    27/04/2008          0          0
           101 abc x Sunday    04/05/2008          0          0
           101 abc x Sunday    11/05/2008          0          0
           101 abc x Sunday    18/05/2008          0          0
           101 abc x Sunday    25/05/2008          0          0
           101 abc x Sunday    01/06/2008          0          0
           101 abc x Sunday    08/06/2008          0          0
           101 abc x Sunday    15/06/2008         45          0
           101 abc x Sunday    22/06/2008          0          0
           101 abc x Sunday    29/06/2008          0          0
           101 abc x Sunday    06/07/2008          0          0
           101 abc x Sunday    13/07/2008          0          0
           101 abc x Sunday    20/07/2008          0          0
           101 abc x Sunday    27/07/2008          0          0
           101 abc x Sunday    03/08/2008          0          0
           101 abc x Sunday    10/08/2008          0          0
           101 abc x Sunday    17/08/2008          0          0
           101 abc x Sunday    24/08/2008          0          0
           101 abc x Sunday    31/08/2008          0          0
           101 abc x Sunday    07/09/2008          0          0
           101 abc x Sunday    14/09/2008          0          0
           101 abc x Sunday    21/09/2008          0          0
           101 abc x Sunday    28/09/2008          0          0
           101 abc x Sunday    05/10/2008          0          0
           101 abc x Sunday    12/10/2008          0          0
           101 abc x Sunday    19/10/2008          0          0
           101 abc x Sunday    26/10/2008          0          0
           101 abc x Sunday    02/11/2008          0          0
           101 abc x Sunday    09/11/2008          0          0
           101 abc x Sunday    16/11/2008          0          0
           101 abc x Sunday    23/11/2008          0          0
           101 abc x Sunday    30/11/2008          0          0
           101 abc x Sunday    07/12/2008          0          0
           101 abc x Sunday    14/12/2008          0          0
           101 abc x Sunday    21/12/2008          0          0
           101 abc x Sunday    28/12/2008          0          0
           101 abc x Sunday    04/01/2009          0          0
           101 abc x Sunday    11/01/2009          0          0
           101 abc x Sunday    18/01/2009          0          0
           101 abc x Sunday    25/01/2009          0          0
           101 abc x Sunday    01/02/2009          0          0
           101 abc x Sunday    08/02/2009          0          0
           101 abc x Sunday    15/02/2009          0          0
           101 abc x Sunday    22/02/2009          0          0
           101 abc x Sunday    01/03/2009          0          0
           101 abc x Sunday    08/03/2009          0          0
           101 abc x Sunday    15/03/2009          0          0
           101 abc x Sunday    22/03/2009          0          0
           101 abc x Sunday    29/03/2009          0          0
           101 abc x Sunday    05/04/2009         50         22
           102 abc x Sunday    06/04/2008          0          0
           102 abc x Sunday    13/04/2008          0          0
           102 abc x Sunday    20/04/2008          0          0
           102 abc x Sunday    27/04/2008          0          0
           102 abc x Sunday    04/05/2008          0          0
           102 abc x Sunday    11/05/2008          0          0
           102 abc x Sunday    18/05/2008          0          0
           102 abc x Sunday    25/05/2008          0          0
           102 abc x Sunday    01/06/2008          0          0
           102 abc x Sunday    08/06/2008          0          0
           102 abc x Sunday    15/06/2008          0          0
           102 abc x Sunday    22/06/2008          0          0
           102 abc x Sunday    29/06/2008          0          0
           102 abc x Sunday    06/07/2008          0          0
           102 abc x Sunday    13/07/2008          0          0
           102 abc x Sunday    20/07/2008          0          0
           102 abc x Sunday    27/07/2008          0          0
           102 abc x Sunday    03/08/2008          0          0
           102 abc x Sunday    10/08/2008          0          0
           102 abc x Sunday    17/08/2008          0          0
           102 abc x Sunday    24/08/2008          0          0
           102 abc x Sunday    31/08/2008          0          0
           102 abc x Sunday    07/09/2008          0          0
           102 abc x Sunday    14/09/2008          0          0
           102 abc x Sunday    21/09/2008          0          0
           102 abc x Sunday    28/09/2008          0          0
           102 abc x Sunday    05/10/2008          0          0
           102 abc x Sunday    12/10/2008          0          0
           102 abc x Sunday    19/10/2008          0          0
           102 abc x Sunday    26/10/2008          0          0
           102 abc x Sunday    02/11/2008          0          0
           102 abc x Sunday    09/11/2008          0          0
           102 abc x Sunday    16/11/2008        100          0
           102 abc x Sunday    23/11/2008          0          0
           102 abc x Sunday    30/11/2008          0          0
           102 abc x Sunday    07/12/2008          0          0
           102 abc x Sunday    14/12/2008          0          0
           102 abc x Sunday    21/12/2008          0          0
           102 abc x Sunday    28/12/2008          0          0
           102 abc x Sunday    04/01/2009          0          0
           102 abc x Sunday    11/01/2009          0          0
           102 abc x Sunday    18/01/2009          0          0
           102 abc x Sunday    25/01/2009          0          0
           102 abc x Sunday    01/02/2009          0          0
           102 abc x Sunday    08/02/2009          0          0
           102 abc x Sunday    15/02/2009          0          0
           102 abc x Sunday    22/02/2009          0          0
           102 abc x Sunday    01/03/2009          0          0
           102 abc x Sunday    08/03/2009          0          0
           102 abc x Sunday    15/03/2009          0          0
           102 abc x Sunday    22/03/2009          0          0
           102 abc x Sunday    29/03/2009          0          0
           102 abc x Sunday    05/04/2009          0          0
    
    106 rows selected.
    

    This query performs a number of things.

    1. the sunday_date_range generates all the Sunday between the pStartDate and the pEndDate

    2. I've made use of a JOIN OUTSIDE of SCORE to generate the date range for EACH ID, GRP and LOC. If you do not have 10g, to implement an alternative workaround.

    3. I join on a date range for a little less than 7 days if all report data fall date Sunday by your condition. This is because on 01/04/2009 is not a Sunday.

    HTH!

  • Windows Media Player 11 Date added function - please stop repeating the date for EACH file.

    I have been using Media Player 9, decided to upgrade to Windows Media Player 11, and the only thing I can not stand on Player 11 is how it sorts Date added media files.  In Player 9 when I chose the column Date added, the program would list all the files on a given under a SINGLE date.  With Windows Media Player 11 it lists EACH file with a date so that instead of see Tuesday, December 14, 2010 once and then listing all of the files under it, I see Tuesday, December 14, 2010 about twenty times.  I download podcasts once a week and dump it on my phone, but it's a worry now.  Is it possible to stop Windows Media Player 11 to repeat the date again and again and force him to the date that the list only once?  Think back to Player 9.  Alex

    Hi Alex103,

    It's design in Windows media player 11 and it is also included in Windows Media player 12.

    However, you can uncheck this option, follow the steps below:

    a. open windows Media player

    b. right-click on one of the sorted column

    c. click Choose column

    d. uncheck data added

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Use the date Format

    Hi all

    I have question,

    "If I get the data of an input parameter 10 December 2013 08:41:53.

    How can I convert the format of date,-> "DD-MM-YYYY".

    Thanks for the help of You ' r

    Hello

    If you have a string str = 10 December 2013 08:41:53 ', you can call TO_DATE to create a DATE from it:

    To_date (str, "MM/DD/YYYY HH24:MI:SS")

    (Assuming that "12" is the month and '10' is the day).

    Once you have a DATE (let's call it dt), you can view it in any format you want using TO_CHAR:

    To_char (dt, "DD-MM-YYYY")

    If you wish, you can nest one of these functions inside each other, like this:

    SELECT TO_CHAR (TO_DATE (' DECEMBER 10, 2013 08:41:53 '))

    , "MM/DD/YYYY HH24:MI:SS.

    )

    'DD-MM-YYYY ".

    ), Exit

    DOUBLE;

    Output:

    OUTPUT

    ----------

    10/12/2013

  • A possible solution for the Date and time January 1, 1970 Bug?

    I fell for a scam currently floating around the Internet, this type of scam to change the date and time of an IPhone on January 1, 1970 made my IPhone stuck in a boot cycle. people use the term "brick" of the nature of bugs. I was curious if there is no fix?

    Put the phone in DFU mode:

    http://www.payetteforward.com/how-to-put-iPhone-DFU-mode/

    You will then need to reload all your data from your back upward.

Maybe you are looking for