Help the query to list all the days between MIN and MAX date in a table

Hello

Sorry, this may have already responded earlier, but I really struggled to find a previous response with the new provision of the RTO.

In a DB 11 g, I date MIN and MAX in a table:

{code}

SELECT MIN (process_date) start_date, MAX (process_date) end_date FROM my_table;

{code}

I would get every day between these 2 dates. I mean even is there is no record in the table for a date.

Is this possible?

Thanks in advance,

Olivier

Hello

Do you mean something like this?

ranit@XE11GR2>> ed
Wrote file c:\rb\1.sql

  1  with xx as
  2  (
  3      select
  4     to_date('05-06-2013','dd-mm-yyyy') min_d,
  5     to_date('20-06-2013','dd-mm-yyyy') max_d
  6      from dual
  7  )
  8  --
  9  -- end of test data
 10  --
 11  select
 12     min_d + level date_x
 13  from xx
 14* connect by level<=(max_d-min_d)
ranit@XE11GR2>> /

DATE_X
-------------------
06-06-2013 00:00:00
07-06-2013 00:00:00
08-06-2013 00:00:00
09-06-2013 00:00:00
10-06-2013 00:00:00
11-06-2013 00:00:00
12-06-2013 00:00:00
13-06-2013 00:00:00
14-06-2013 00:00:00
15-06-2013 00:00:00
16-06-2013 00:00:00
17-06-2013 00:00:00
18-06-2013 00:00:00
19-06-2013 00:00:00
20-06-2013 00:00:00

15 rows selected.

Tags: Database

Similar Questions

  • Simply select the values between min and max of a value accumulated during the day

    Hello Forum,

    a value is accumulated more a day and over a period of time. The next day, the value is reset and starts to build up again:
    with sampledata as (select to_date('09.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 23 val from dual union all
                       select to_date('09.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 29 val from dual union all
                       select to_date('09.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 30 val from dual union all
                       select to_date('09.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 45 val from dual union all
                       select to_date('09.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 60 val from dual union all
                       select to_date('09.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 75 val from dual union all
                       select to_date('09.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 95 val from dual union all
                       select to_date('09.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('09.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('09.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('09.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('09.09.2012 17:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('09.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('09.09.2012 23:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 00:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 01:03:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 02:54:11', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 03:04:08', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 04:04:19', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 05:04:20', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 06:12:02', 'dd.mm.yyyy hh24:mi:ss') ts, 14 val from dual union all
                       select to_date('10.09.2012 07:12:03', 'dd.mm.yyyy hh24:mi:ss') ts, 34 val from dual union all
                       select to_date('10.09.2012 08:12:04', 'dd.mm.yyyy hh24:mi:ss') ts, 58 val from dual union all
                       select to_date('10.09.2012 09:12:11', 'dd.mm.yyyy hh24:mi:ss') ts, 70 val from dual union all
                       select to_date('10.09.2012 10:12:12', 'dd.mm.yyyy hh24:mi:ss') ts, 120 val from dual union all
                       select to_date('10.09.2012 11:12:13', 'dd.mm.yyyy hh24:mi:ss') ts, 142 val from dual union all
                       select to_date('10.09.2012 12:21:24', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
                       select to_date('10.09.2012 13:21:26', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
                       select to_date('10.09.2012 14:21:27', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
                       select to_date('10.09.2012 15:21:30', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
                       select to_date('10.09.2012 16:21:32', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual union all
                       select to_date('10.09.2012 21:21:33', 'dd.mm.yyyy hh24:mi:ss') ts, 153 val from dual)
    select   ts, val
    from     sampledata
    order by ts asc;
    How should I change the select statement to ignore all data sets before the first minimum and duplicates after the maximum of a day to get such a result:
    TS     VAL
    09.09.12 06:12     23
    09.09.12 07:12     29
    09.09.12 08:12     30
    09.09.12 09:12     45
    09.09.12 10:12     60
    09.09.12 11:12     75
    09.09.12 12:21     95
    09.09.12 13:21     120
    09.09.12 14:21     142
    10.09.12 06:12     14
    10.09.12 07:12     34
    10.09.12 08:12     58
    10.09.12 09:12     70
    10.09.12 10:12     120
    10.09.12 11:12     142
    10.09.12 12:21     153
    Thank you

    Hello

    msinn wrote:
    Hello Forum,

    a value is accumulated more a day and over a period of time. The next day, the value is reset and starts to build up again:

    Thanks for posting the sample data and results. Be sure to explain how you get these results from these data. For example "for each day, I just want to show the lines after the daily low was reached. For example, on September 9, the lowest val was 23, which occurred at 6:12, so I don't want to show all lines earier to 06:12 September 9. In addition, when a val is the same as or more than the previous same day val (in order by ts), then I don't want to display the line later. For example, on 9 September, there are several consecutive lines, starting at 14:21 which all have the same val, 142. I want to only display the ealiest of this group, the line of 14:21. »

    Here's a way to do it, using analytical functions:

    WITH   got_analytics     AS
    (
         SELECT  ts, val
         ,     MIN  (val) OVER ( PARTITION BY  TRUNC (ts)
                                  ORDER BY       ts  DESC
                        )      AS min_val_after
         ,     CASE
                  WHEN  val = MIN (val) OVER (PARTITION BY  TRUNC (ts))
                  THEN  -1    -- Impossibly low val.  See note below
                  ELSE  LAG  (val) OVER ( PARTITION BY  TRUNC (ts)
                                              ORDER BY         ts
                               )
              END      AS prev_val
         FROM    sampledata
    )
    SELECT       ts
    ,       val
    FROM       got_analytics
    WHERE       val     <= min_val_after
    AND       val     >  prev_val
    ORDER BY  ts
    ;
    

    This requires that val > = 0. If you don't know a lower bound for val, and then the same basic approach still works, but it's a bit messier.

  • How can I justify the difference between varchar and varchar2 data type

    Hi all

    How can I justify the difference between the data type varchar and varchar2 on any table for space management.
    Is there any query to justify this.


    Concerning
    Girish

    Published by: boujemaa on February 2, 2011 21:23

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14220/datatype.htm#sthref3780


    The VARCHAR data type

    The VARCHAR data type is synonymous with the VARCHAR2 data type. To avoid any changes in behavior, always use the VARCHAR2 data type to store strings of variable length.

  • I get a message saying "you have exceeded your profile storage space. Yet all the files listed th are actually my docs and application data. How to delete my profile, but not from my pc? increase the max profile size

    I get a message saying "you have exceeded your profile storage space. Yet all the files listed th are actually my docs and application data. How to delete my profile, but not from my pc? increase the max profile size

    1. the first thing to do is to make sure that the computer is completely virus/malware-free. Googling around this error produced quite a few links where the posters were or had been infected with Spyware Protect 2009 rogue.

    http://www.elephantboycomputers.com/page2.html#Removing_Malware

    Once the scanning is complete (do not skip the preparatory stages no more), if the problem persists:

    2. double-click on my computer, right-click the icon for your hard drive, click left to get its properties. If you see options to set Quota management make sure that they are disabled.

    3. in the case - BUT ONLY AFTER YOU ARE sure THAT THE MACHINE IS MALWARE/VIRUS-FREE - copy the lines between asterisks (not including the asterisks) below and paste it into Notepad. Save as undopolicy.reg somewhere, you will find. And then double-click the .reg file, that you have just made to melt in your registry. I hope that this will take care of the issue.

    *****
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
    'EnableProfileQuota ' = -.
    'ProfileQuotaMessage ' = -.
    "MaxProfileSize" = -.
    'IncludeRegInProQuota ' = -.
    'WarnUser ' = -.
    'WarnUserTimeout ' = -.
    *****

    MS - MVP - Elephant Boy computers - don't panic!

  • What is the difference between 'Photos' and 'All of them'?

    I migrated to iPhoto to picture several months ago.  I also stored pictures in iCloud.  I have about 8 000 photos.

    On the Photo, there is a file in the upper left corner labeled "pictures".  Under the Albums, there is an another Doggie labelede "All Photos".   A lot of photos in "All Photos" and not in "Photos".   I also have a lot of iPhoto events listed.  A lot of photos in the folder "Pictures" are not in the folder "pictures".   What can someone tell me the difference between these two cases?  They are obviously different.

    'Photos' brings together the photos and displays at the top of each group a place and date (month and day only, no year).    "All Photos" has a beginning and end date day, month, year.  But nothing else that a continuous string of pictures without separation, titles or dates.  The start date is not correct.

    I find pictures more confusing and difficult to know how to navigate around.  I guess the 'Pictures' folder is the pictures on iCloud?  (Is there a download button on the lower left corner of each photo).

    they are not records - Photos is your library and is sorted by the date photo number - it can show the years or collections or moments

    All Photos is a special photo album and is sorted by the date, the photos are added to Photos

    Unless you have a corrupt library all in all Photos is also in pictures and numbers are the same

    If you use iCLoud library then your library is synchronized via iCLoud to all devices so seeing pictures is the same as the iCLoud.com view and like on every IOS device or another Mac using ICPL under the same Apple ID

    LN

  • What is the difference between Fdisk and Chkdsk programs?

    Hello:

    I don't think I have a common question of OS knowledge and I worked a lot with both, however for years so I forgot everything I used to know.  I was talking to someone Executibles MS-DOS command line and this person I know told me in email and I did not at the moment, but he said the following:

    "Fdisk and chkdsk are pretty much the same.

    Being an old Microsoft OS Engineer I knew it was wrong, however I've been retired since almost 20 years and I have not worked with either for a while.  I looked in the KB for articles explaining the difference between fdisk and chkdsk or define at least the two against each other, but there is no specific article I could find.  I remember the days when the scariest user had a problem, but they ran all third party software on their computer and have installed BETA version software etc so I'm sure you know the drill and this type of person.

    The person who said this about fdisk and chkdsk is one of those people.  It is a really nice guy, but a nightmare to Microsoft when you talk to a convenience store to the BONE for assistance.  Is there someone out there who could you, please, help me and summarize an irrefutable definition or description indicating the differences between fdisk and chkdisk?  I don't remember the basic functions both I widely used both, but too many years have passed and I don't want to sound like a fool trying to write about the differences.

    I'd appreciate any help I want to educate my friend and the intention is to not make this person feel like a stupid either.

    Thank you, and I expect your response.

    Eric

    The two are completely different, one is a format utility the other is a utility disk check

    http://support.Microsoft.com/kb/255867/en-us

    Fdisk was used in earlier versions of victory

    http://Windows.Microsoft.com/en-GB/Windows/Fdisk-FAQ#1TC=Windows-7

  • How to tell the difference between recommended, and optional updates long after they have installed bene?

    I have a Vistaprogram of the window running on my Toshiba laptop.

    In the past, I've confirmed that optional udates be installed. Please help: now I want to uninstall optional updates because my computer is slow.  How to tell the difference between recommended, and optional updates long after they have installed bene?

    Hey monkey 44,

    I suggest you view the history in Windows Update:

    http://Windows.Microsoft.com/en-us/Windows-Vista/see-which-Windows-updates-are-installed

    Those listed as recommended is technically optional.

    Before you delete updates the computer, I suggest you try the steps from the following link to improve performance and check if that helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/ways-to-improve-your-computers-performance

    I hope this helps.

  • What is the difference between OCÉ and (OCP and OCS)

    What is the difference between ECAS and (OCP or OCS).

    For example, I heard that OCS helps with the language

    and the marketing of a product.

    Could this be true as ECAS focuses on how to do things.

    and not so much things to a much higher level.

    For example, how do you set up, how you use it, how do you start, etc.

    Thank you Roger

    Roger,

    OCÉ Doghouse more. These certifications can be more CERT of intermediate or high level certificates. These were specifically developed for the gaps in the certification that did not match our OCA, OCP, hierarchy of the CMO.

    Generally, the CERT of the OCS tend to focus more on implementation. These certificates have been developed for the Oracle PartnerNetwork for areas of certification which specifically serve Oracle partners and qualify them for levels of specialization. These certifications are available for all candidates, but are directed towards members of OPN.

    I hope this helps.

    Kind regards
    Brandye Barrington

    Oracle Certification program

  • The differences between CAT and table TAB

    1. What is the difference between cat and TAB?
    2. why TAB does not exist in dict?
    3. that the same situation for cat and TAB?

    Thanks a lot for your answer kindly.

    sys@ORCL > cat desc
    Name Null? Type
    ----------------------------------------------------- -------- ------------------------------------
    TABLE_NAME NOT NULL VARCHAR2 (30)
    TABLE_TYPE VARCHAR2 (11)

    sys@ORCL > tab desc
    Name Null? Type
    ----------------------------------------------------- -------- ------------------------------------
    TNOM NOT NULL VARCHAR2 (30)
    TABTYPE VARCHAR2 (7)
    NUMBER OF CLUSTERID

    sys@ORCL > select * dict where table_name = "CAT";

    TABLE_NAME COMMENTS
    ---------- -----------------------------------
    Synonym of cat for USER_CATALOG


    sys@ORCL > select * dict where table_name = 'USER_CATALOG ';

    TABLE_NAME COMMENTS
    -------------------- -----------------------------------------------------------------
    USER_CATALOG Tables, views, synonyms, and sequences belonged to the user

    You've posted enough to know that, for each position, you will need to provide your version of Oracle 4-digit (SELECT * FROM V$ VERSION)
    >
    1. What is the difference between cat and TAB?
    2. why TAB does not exist in dict?
    3. that the same situation for cat and TAB?
    >
    1, 2, 3 - TAB has been deprecated then don't use it.

    Definitioni of base for those located in the reference database
    http://docs.Oracle.com/CD/B28359_01/server.111/b28320/statviews_2127.htm#sthref1535
    >
    CAT

    CAT is a synonym for USER_CATALOG.
    . . .
    USER_CATALOG

    USER_CATALOG lists all the tables, views, clusters, synonyms, and sequences belonged to the current user. Its columns are the same as those of "ALL_CATALOG".
    . . .
    DICT

    DICT is a DICTIONARY.
    . . .
    DICTIONARY

    DICTIONARY contains descriptions of data dictionary tables and views.
    . . .
    TAB

    TAB is included for compatibility. Oracle recommends that you do not use this view.
    >
    TAB has been deprecated. He looks like the cat because it shows the USER objects, but it does not show the sequences, like the cat.

    If you look at the source code for the views TAB and USER_CATALOG you can see the differences. This code is copyrighted by Oracle Corporation, all rights reserved.

    /* Formatted on 1/1/2013 8:50:07 AM (QP5 v5.115.810.9015) */
    CREATE OR REPLACE FORCE VIEW SYS.TAB
    (
       TNAME,
       TABTYPE,
       CLUSTERID
    )
    AS
       SELECT   o.name, DECODE (o.type#,
                                2,
                                'TABLE',
                                3,
                                'CLUSTER',
                                4,
                                'VIEW',
                                5,
                                'SYNONYM'), t.tab#
         FROM   sys.tab$ t, sys."_CURRENT_EDITION_OBJ" o
        WHERE       o.owner# = USERENV ('SCHEMAID')
                AND o.type# >= 2
                AND o.type# <= 5
                AND o.linkname IS NULL
                AND o.obj# = t.obj#(+);
    . . .
    /* Formatted on 1/1/2013 8:54:45 AM (QP5 v5.115.810.9015) */
    CREATE OR REPLACE FORCE VIEW SYS.USER_CATALOG
    (
       TABLE_NAME,
       TABLE_TYPE
    )
    AS
       SELECT   o.name,
                DECODE (o.type#,
                        0, 'NEXT OBJECT',
                        1, 'INDEX',
                        2, 'TABLE',
                        3, 'CLUSTER',
                        4, 'VIEW',
                        5, 'SYNONYM',
                        6, 'SEQUENCE',
                        'UNDEFINED')
         FROM   sys."_CURRENT_EDITION_OBJ" o
        WHERE   o.owner# = USERENV ('SCHEMAID')
                AND ( (o.type# IN (4, 5, 6))
                     OR (o.type# = 2 /* tables, excluding iot - overflow and nested tables */
                         AND NOT EXISTS
                               (SELECT   NULL
                                  FROM   sys.tab$ t
                                 WHERE   t.obj# = o.obj#
                                         AND (BITAND (t.property, 512) = 512
                                              OR BITAND (t.property, 8192) = 8192))))
                AND o.linkname IS NULL;
    
  • What is the difference between extensions and Plugins and Add-ons?

    I'm sorry if here is not the right place for this post.

    What is the difference between extensions and Plugins and Add-ons? Apparantely, they differ in some sense or aspect, but I do not know how. Please, if it is not too complicated, explain in detail and simple language. Thanks in advance to 1 million.

    Kind regards
    Danesh

    Hi Danesh,

    You should take a look at this article for an explanation. Plugins and extensions are essentially types of Add-ons as well as of the characters and themes.

    Hope this helps!

  • Whenever I type the letter between f and h (he can't come in here or the problem occurs, so I will use 'p' instead), the locking of the keyboard and an informal search screen is displayed in the toolbar. Also happeninp in emails and 'my documents' but no

    I can't use a certain letter on my keyboard when in Firefox, email or my documents without the Freezin' screen and a pop up appears in my toolbar for a brousin site. The character I can not type is the letter between f and h in the alphabet. I have no problem with this letter in other applications, so I know that's not the keyboard. How to make and use this letter?

    This has happened

    Don't know how many times

    Is a week by o

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of your modules is causing your problem (switch to the DEFAULT theme: Tools > Modules > themes).
    See the extensions, themes and problems of hardware acceleration to resolve common troubleshooting Firefox problems and troubleshooting questions with plugins like Flash or Java to solve common Firefox problems

    If this does not work in safe mode and then disable all your extensions and then try to find out who is causing by allowing both the problem reappears.
    You can use 'Disable all add-ons' on the start safe mode window.
    You will need to close and restart Firefox after each change through "file > exit" (on Mac: "Firefox > Quit")

  • the min and MAX values maintain their good values tia sal22

    the min and MAX values maintain their good values tia sal22

    Hi all

    I have problems a little value to stay in their correct min and max values min and max.
    Continue to change their values (up and down) trying to get the max value to only display the maximum value at a given time and the same for the min value.  I looked at the examples max and min and it seems that it should be in a while loop
    http://forums.NI.com/NI/board/message?board.ID=170&thread.ID=359822

    but I would add another while loop and if so put it in the loop for? or is there a better way to do it.

    TIA sal22

    Hi sal22,

    I thought it was just one example you found somewhere, because it is called red rooster. See the attached example.

    Mike

  • Delete the min and max labels on chart axis markers

    Hello

    Is it possible to remove the min and max labels on chart axis markers? For example, see the screenshot below. Can I remove the numbers circled in green without changing the range of the axis? In some cases (like this one), the presence of the min and max number of cases other marker values to not be displayed (red line). I am aware that "10" is displayed if I enlarge the graph, but this isn't an option for my application. FYI - the screenshot is from the side before the attached VI.

    Thanks for any help,

    Kind regards

    Stu

    You can't delete them because they are the main features to be able to set the max and min on the graph of the Panel before if you use no-AutoScaling.

  • What is the difference between tear and Brüning cd

    What is the difference between tear and Brüning a cd.

    Hi SirNickLong,
    Here are a few links to explain the difference:
    http://Windows.Microsoft.com/en-us/Windows-Vista/rip-music-from-a-CD
    http://Windows.Microsoft.com/en-us/Windows-Vista/demo-burn-a-CD-or-DVD
    hope this helps,
    Eddie B.

  • What is the difference between nc6320 and nx6320 laptops?

    What is the difference between nc6320 and nx6320 laptops?

    Can I use the same drivers for each of them?

    Hello:

    There is not much difference.

    If you want to compare all the details you can check this link:

    http://h18000.www1.HP.com/products/QuickSpecs/12428_div/12428_div.PDF

    You can probably use the same drivers for either, but they all have both their own support pages and separate driver.

    nc6320:

    http://h20000.www2.HP.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=1839154&lang=en&cc=us&TaskID=135&prodSeriesId=1839146&prodTypeId=321957

    NX 6320:

    http://h20000.www2.HP.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=1839169&lang=en&cc=us&TaskID=135&prodSeriesId=1839144&prodTypeId=321957

    Paul

Maybe you are looking for