Find out missing dates in table

Hi,
I've a table that sould have a record for day with sales info, but for some reason there are missing dates, is there any way i could find out witch dates are missing.
Table Example:
sales_date | value
2010-01-01 | 20
2010-01-02 | 30
2010-01-04 | 40
The output of the query for the example above sould return only the missing date (2010-01-03).
Thanks in advance

How about (I wouldn't use this if your concerned about speed!)...
WITH src_data
       AS (SELECT TO_DATE('2010-01-01', 'YYYY-MM-DD') sales_date FROM DUAL
           UNION ALL
           SELECT TO_DATE('2010-01-02', 'YYYY-MM-DD') sales_date FROM DUAL
           UNION ALL
           SELECT TO_DATE('2010-01-04', 'YYYY-MM-DD') sales_date FROM DUAL),
    date_table
       AS (SELECT     LEVEL, MAX(sales_date) - LEVEL + 1 my_date
           FROM       src_data
           CONNECT BY LEVEL <=
                         (SELECT MAX(sales_date) - MIN(sales_date) + 1
                          FROM   src_data)
           GROUP BY   LEVEL
           ORDER BY   my_date ASC)
SELECT *
FROM   date_table
WHERE  NOT EXISTS (SELECT 1
                   FROM   src_data
                   WHERE  sales_date = my_date)Cheers
Ben

Similar Messages

  • How to find out when data was deleted from table in oracle and Who deleted that

    HI Experts,
    Help me for below query:
    how to find out when data was deleted from table in oracle and Who deleted that ?
    I did that to fidn out some data from dba_tab_modifications, but I m not sure that what timestamp shows, wether it shows for update,insert or delete time ?
    SQL> select TABLE_OWNER,TABLE_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP,DROP_SEGMENTS,TRUNCATED from dba_tab_modifications where TABLE_NAME='F9001';
    TABLE_OWNER                    TABLE_NAME                        INSERTS    UPDATES    DELETES     TIMESTAMP         DROP_SEGMENTS TRU
    PRODCTL                        F9001                                                     1683         46       2171            11-12-13 18:23:39             0                   NO
    Audit is enable in my enviroment?
    customer is facing the issue and data missing in the table and I told him that yes there is a delete at 11-12-13 18:23:39 in table after seeing the DELETS column and timestamp in dba_tab_modifications, but not sure I am right or not
    SQL> show parameter audit
    NAME                                 TYPE        VALUE
    audit_file_dest                      string      /oracle/admin/pbowe/adump
    audit_sys_operations                 boolean     TRUE
    audit_syslog_level                   string
    audit_trail                          string      DB, EXTENDED
    please help
    Thanks
    Sam

    LOGMiner --> Using LogMiner to Analyze Redo Log Files
    AUDIT --> Configuring and Administering Auditing

  • Moving data between tables (how to find out if the 2nd table is empty)

    Hi,
    I have 2 tables, and I'm copying records from one table to another.
    I've followed the Wiki: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/movingdatabetween+tables]
    So far, everything works ok.
    Here is my question: how do I get the number of records passed?
    I mean, how do I know the number of rows in the 2nd table? (Remember that this number is variable, because it depends on how many rows I've inserted and deleted on the 2nd table).
    I've tried to achieve that using a data store with a numeric field, but I couldn't find the way to increment/decrement the numeric field on data store, and insert/delete the row on table at the same time .
    All I want is to find out if the 2nd table is empty or not.
    Any ideas to solve this?
    Thanks in advance!
    Help will be point-rewarded.
    Marcelo

    Hi Ahmed
    thanks for your reply, it was very helpful!! (I've assigned points to you)
    However the user can add twice or more times the same row... so the counter doesn't reflect the real number of rows in the 2nd table.
    I've partially solved this also using a data store with a parameter called key_list, where I add (I mean, concatenate) the key field for the selected row.
    So, if I have a table with 4 rows with key fields "key1", "key2", "key3", the parameter key_list would get "key1;key2;key3".
    So far, it's ok. But when I remove a row previosly added.... I can't remove the key from the key_list parameter. (I mean, from 2nd table I choose to remove the "key2" row, but I don't know how also remove the key name from the key_list)
    I hope be clearly enough.
    Any help will be really appreciated and point-rewarded.
    Thanks again.
    Best Regards
    PS: is there any way of "mark" a row that has been added to the 2nd table? I mean, using (for example) a hidden boolean field named "added", that becomes true when the selected row is added to the 2nd table.

  • How to find out structure of internal table?

    Hi
    is there any way how to find out name of structure upon which internal
    table was created?
    i got internal table passed to function module by any table
    type. There can be different types of table passed in. Inside of
    module a need to find out the structure of table.
    I've found a tricky way how to find this information using following
    command 'DESCRIBE FIELD dobj INTO td.', but its probably not a correct
    way because using this command is not recommended in application
    programs.
    Is there any function module, or something i can use for getting this information?
    Thanks

    Thanks very much
    This has solved my problem:
      DATA descr_ref TYPE ref to cl_abap_typedescr.
      DATA tabname TYPE string.
      descr_ref = cl_abap_typedescr=>describe_by_data( itab ).
      tabname = descr_ref->absolute_name.

  • Hi help me to find out----- Reversal Date

    Hi
    help me to find out Reversal Date:
    Since this is a month end accrual posting, it will be autoreversing so it will post the expense to the last day of the current month and post the reversing entry on the 1st day of the next month which is determined by taking the 1st day of the month following the month for which the dates have been entered

    Hi,
    The reversal documents are identified in a table based on movement type ( in MSEG ).
    Example: 131 for posting and 132 for reversal.
    For the same document if exists a reversal movement type then the document is reversed.
    You will also get the reversal document no from the table record.
    Check the table whichever suits your requirement.

  • Write a procedure to find out the data copy is happening or not.

    Good Day all,
    I have two databases called "*Report*" and "*Production*". I have a report database which copy a data from production database. I want to write a Stored procedure to compare the count of one table in both the databases. All the tables are same in both the databases.
    Please note :*
    1. We are writing the procedure to find out the data copy is happening or not and also report database is down or not.
    2. Not all times, the both the count is same, sometimes it take delay to copy the data in report database but report database is not down.
    Please see the query to compare
    _"Report"_
    Select count(*) from trx where date ='03-Oct-2010'
    *"Production"*
    Select count(*) from trx where date ='03-Oct-2010'
    I am suggesting to take a count for every 5 mins and keep in temp table and compare it.
    Thanks
    Nihar

    How are you replicating the data from the production database to the reporting database?
    Wouldn't it make more sense to monitor that replication process rather than counting every row in the table every 5 minutes? That's going to get rather expensive for non-trivial tables. If you are using something like Streams to replicate the data, it would make far more sense to monitor the Streams apply process, to determine when the reporting database it updated as of, than it would to monitor the underlying tables.
    Justin

  • How can I find out the date of a movie I am trying to pre-order if the date is not available/showing in the "manage pre-order" section?

    How can I find out the date of a movie I am trying to pre-order if the date is not available/showing in the "manage pre-order" section?

    Thanks so much for your reply King_Penguin. No, sadly there is not indication of the expected release date on the film, it's no where to be found. I have also tried to look in other places online, but no luck. I guess your latter statement jives more with my situation, that  being the studio/rights-holder hasn't feel inclined to provide the date.

  • How do I find out the date in which I registered my imac?

    How do I find out the date in which I registered my imac?

    It doens't really matter what date you registered it. However if you are looking to see when your expiration on AppleCare is/was it is 3 years from the original date of purchase. You can use the Apple Online Service Assistant afer you input the serial number click the link that says See your service and support coverage.

  • How to find out which data control do the page layout components come from?

    hi,
    work in Jdev 11.1.2.3
    After have drag and drop data control into pages designer, how to find out which data control do the page layout component (such as a field in form layout) come from?
    --i cannot find data control related information in the property pallete for the page layout component.
    Regards.

    This information can be found in the page definition file.
    Select the field in the page and then click the binding tab.

  • How to find out the date of license conversion (from Standard to Datacenter)?

    I had problems with Microsoft licensing and i need to find out, when my servers was converted from Standard to be Datacenter ?
    All my servers was standard, now it's Datacenter and i need to know from when it's Datacenter ???

    What I really mean is that I have EA with Microsoft and I'm eligible for example 10 Standard and 5 Datacenter.
    During Microsoft auditing they found that I have installed 10 Datacenter and 5 Standard, which is not original design, so obviously someone from my team converted 5 servers from Standard to Datacenter.
    My question here that I need to know when exactly my servers where converted, so I can know who converted it as this mistake costs my company a lot!
    I need to know time and data when my server was converted from Standard to Datacenter edition? May be it's recorded in registry or somewhere i can find using PowerShell or something, the same Idea of finding out Installation date using this command:
    "([WMI]'').ConvertToDateTime((Get-WmiObjectWin32_OperatingSystem).InstallDate)"
    Ah, that helps me understand, thanks.
    If you installed Standard, and then used DISM /Online /Set-Edition.....
    http://technet.microsoft.com/en-us/library/jj574204.aspx
    this should be logged in the DISM logfile: %windir%\Logs\DISM
    https://technet.microsoft.com/en-us/library/ee851579(v=ws.10).aspx
    You may also find some details in the Windows event logs (if you still have that history available).
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • How to find out the Non Partitioned Tables used 2Gb on oracle

    Hi team
    how to find out the Non Partitioned Tables used > 2Gb on oracle where not is sys & system
    regards

    heres 1 I made earlier
    set pagesize 999
    set linesize 132
    col owner format a25
    col segment_name format a60
    select owner,segment_name,segment_type,(bytes/1024/1024)"MB size"
    from dba_segments
    where owner not in ('SYS','SYSTEM','XDB','MDSYS','SYSMAN') -- edit for taste
    and segment_type = 'TABLE'
    having (bytes/1024/1024) > 2000
    group by bytes, segment_Type, segment_name, owner
    order by 4 asc

  • Query to find out the list of tables used in a package

    hello,
    can anyone please help me out with a query; i want to find out the list of tables used by a particular package.
    thanks,
    orton

    orton607 wrote:
    thanks for replying guys. But the thing is i am using dynamic sql execute immediate in my package, so i want those tables also and the schema name.
    thanks,
    ortonThis is not possible. The best you could do is to have a good guess.
    Or how would you parse some dynamic statement as this:
       v_suffix := 'loyees';
       v_sql := 'Select count(*) from (select ''nonsense'' col1 from emp'||v_suffix||') where col1 = ''Y'''';
       execute_immediate(v_sql);
    ...What is the table name? How do you want to parse that?
    Better rewrite all dynamic SQL statements into non dynamic ones. Or do the source control logic for those dynamic parts in an extra module. For example implement your own dependency table and force every developer to add there all dynamic parts.

  • How can I find out my data usage for the past 3 months?

    Greetings all, I have been a long time Verizon customer, and as such I, along with my husband, was grandfathered into the unlimited data plan. When I last spoke to a representative, they informed me that the only way we were going to be able to keep our unlimited data was by paying the full retail price ($600+) to get a new phone. So we were considering upgrading and changing to one of the newer data plans so we could still get the discounted price on the new phone, but I would like to make sure I choose one with enough data, without paying for a bunch of data that I don't use, however MyVerizon only shows me the amount I have used since the start of the billing cycle. Is there a way to find out the data usage for both my husband and myself for the last 3 months so I can choose the right option?
    Thanks in advance for your help!

        Hello sweetpea1221! How exciting that you're considering upgrading with us. mrhelper is helpful, indeed. You can view your data usage for each line under the View Bill option via your My Verizon account. You can also view your 3 month average  data usage with our Account Analysis feature. Here's a link that will be helpful in doing so http://bit.ly/vnLjqO. I'm confident that we have a great plan to match your data needs. Please let us know if you have further questions.
    TanishaS1_VZW
    Follow us on Twitter @VZWSupport

  • Query to find out list of the tables getting selected frequently

    Hi All,
    Please tell me Is there any way to find out list of the tables getting selected frquently, ( please exclude the insert+updates+deletes+truncate+drop).
    Regards

    Hi Sameer
    You can check V$SQL_PLAN to see the objects being accessed by your SQL statements. If you have diagnostic licence, you can also check DBA_HIST_SQL_PLAN
    select distinct object_owner, object_name from v$sql_plan;
    select object_name, count(*) from v$sql_plan group by object_nameRemeber, this is only a crude way of finding this information.
    Regards
    Venkat

  • How to find the deleted data in tables

    guys,
    how to find the deleted data in tables example: i want to see whether anyone deleted data in MB5B report tables like mbew, etc.,
    regards,

    Hi,
    MBEWH is actually the history table of MBEW. It will record all the changes. As I have told you earlier if you have deleted the record dirctly from the table then it will not come even in the table MBEWH
    That means no changes have been made.
    regards

Maybe you are looking for

  • Questions in XI scenarios

    Hi all, I am trying some scenario in XI, i have some Q`s regarding it: 1) The scenario is picking a file from SIEBEL     system >XI>R/3 system In this scenario, should i choose a BC or FILE adapter to pick up the file from SIEBEL and post it into the

  • Flash Board Game - If a player's destination space has a player on it already, move one more space.

    I have been struggeling with this for sometime and I am totally stuck. In my flash boardgame I am trying to make players unable to land ontop of each other. The code I am currently using compares the current space of Red Player comparing it to where

  • Best practice for interface

    I would assume with all the different interfaces available in SAP for various modules SAP would ahve published a white paper on how to determine the best interface format for a system and what would be the best practice around it. Can someone share a

  • How to add multiple tasks to the worklist view?

    Hi, We are creating a view based on our BPM process and we are using OBPM 11.1.1.4. We do have 2 human workflow tasks in the process. While creating views in the worklist we are able to add only one task is there a way to add multiple tasks to one vi

  • CSS Background colour only showing up in IE

    I have made a simple page after spending hours on my main page trying to fix this problem. When I add, float:left; & float:right; to #left & #right, the, background-color:#fff; in the wapper <div> disappears but only in anything other than IE. This i