Finding Gaps in the date field.

Hello,
I have a date field in a table which has date values incremented every month for 5 years.
I have to find out the any gaps between the months that is the entry for some month is not there.
eg. the data is as follows, i have entries for dec month of 2000, jan of 2001, feb of 2001, march of 2001, April month is missing, there is entry for may of 2001 and it follows.
I want to display that April month is missing.
How would i do in pl/sql.
Help would be appreciated
thanks.
return_dt
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
return_dt
6/30/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM

SELECT A.MISSING_MONTHS
FROM (select DISTINCT TRUNC(B.DATES,'MON') MISSING_MONTHS
         from(select ADD_MONTHS(sysdate, (MONS_BACK*-1) ) + rownum dates
                 from dual,
                     (SELECT MONTHS_BETWEEN (TRUNC(SYSDATE,'MON'),MIN(TRUNC(RETURN_DT, 'MON')) ) MONS_BACK
                          FROM DATE_TAB)
              connect by rownum < 1000) B ) A
WHERE A.MISSING_MONTHS <=(SELECT MAX(TRUNC(RETURN_DT, 'MON')) FROM DATE_TAB)
  AND A.MISSING_MONTHS NOT IN (SELECT TRUNC(RETURN_DT, 'MON') FROM DATE_TAB)

Similar Messages

  • SSRS find max of converted date field

    Hi
    My SSAS source has a date field in this for mat dd/MM/yyyy which is stored as a string.
    In ym report when I find the MAx of this field it is doing it by the day rather than the date.
    I have tried the following but it doesn't seem to work it just errors on the report, how can I get this to work.
    Thanks
    =MIN(FORMAT(datevalue(Fields!DDMMYYYY.Value),"dd/MM/yyy"))
    when converting say 28/10/2013 it is saying the date is not valid so I think it is trying to do mm/dd/yyyy

    Hi aivoryuk,
    Based on your description that you have problem by using the expression "=MIN(FORMAT(datevalue(Fields!DDMMYYYY.Value),"dd/MM/yyyy"))" to convert the string date fields "dd/MM/yyyy" to date type  "dd/MM/yyyy" and
    get the minimum date ,right?
    I have tested on my local environment and can reproduce the issue, the issue can be caused by the CDate("dd/MM/yyyy") function is not invalid, the CDate() function not support the format "dd/MM/yyyy", but support this format "MM/dd/yyyy",
    so you can add an calculated fields which have the changed format date of "MM/dd/yyyy" first.
    Details information for your reference:
    Right click the DataSet(DataSet1) and select the "Add Calculated fields" to create the New fields:
    Name:NewDate
    Value:using this expression to get the "MM/dd/yyyy" formatted date:
    =split(Fields!DDMMYYYY.Value,"/")(1)&"/"& split(Fields!DDMMYYYY.Value,"/")(0)&"/"&split(Fields!DDMMYYYY.Value,"/")(2)
    Modify the current expression "=MIN(FORMAT(datevalue(Fields!DDMMYYYY.Value),"dd/MM/yyy"))"
    as below:
    =Format(MIN(CDate(Fields!NewDate.Value),"DataSet1"),"dd/MM/yyyy")
    OR you can using this expression:
    =Format(Min(DateValue(Fields!NewDate.Value),"DataSet1"),"dd/MM/yyyy")
    Note: this function Min() can add an scope as needed like Min(CDate(Fields!NewDate.Value),"Scope")
    Preview you will get the proper result:
    If your problem still exists, please feel free to ask.
    Regards
    Vicky Liu
    Thanks Vicky that worked a treat.
    What I also did was to bring into the cube the date field as a date (yyyy-mm-dd) format and then used and then used Vikash16 suggestion that also works.
    Nice to have a couple of solutions.
    Regards

  • How to add the date field in the dso and info cube

    Hi all.
    I am new to bi 7. in the earlier version v hav to button to add the date field. but in the bi 7 der is no option so can any body tell me how to add the date field in the data targets
    Thanks & Regard
    KK

    my prob is solved
    KK

  • I have installed the latest version of iOS in my ipad but forgot to backup the content, what should i do!!! I don't want my media and other data erased, how can i find back all the data in my ipad? I haven't restore ipad yet, so any others way can be use?

    I have installed the latest version of iOS in my ipad but forgot to backup the content, what should i do!!! I don't want my media and other data erased, how can i find back all the data in my ipad? I haven't restore ipad yet, so any others way can be use? Now my ipad is in recovery mode.

    Once you are in Recovery Mode, it's too late to do any backup. I am afraid you are going to lose your data.

  • When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    It's probably the fields highlight color of the application, which you can change via Edit - Preferences - Forms.

  • Problem with the date field in Table Control

    I have created a table control in my module programming. One of the column in the table control is a date field which is I/O field.
    Now if I enter a value in date field column and hit enter the date field is reset. I dont want the field to get reset and accept valid date field.
    I have set type of the column as DATS and I havent used any dictionary fields. The column is from the internal table in the program.
    Please suggest

    In your PAI, in the LOOP AT <itab> did you
    - check date validity
    - update internal table
    * Sample
    LOOP AT itab.
      FIELD itab-field MODULE checkfield.
      MODULE updateitab.
    ENDLOOP.
    Look also at SAP documentation like [Table Controls|http://help.sap.com/abapdocu/en/ABENTABLE_CONTROL1_ABEXA.htm] or [Table Controls in ABAP Programs|http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm]
    Regards,
    Raymond

  • Strange error in online Adobe form for the date field

    Hi Experts,
    I am facing strange problem with online Adobe forms. I could able to save data when i click save button on the form.
    But some times in the form the date field is throwing error message 'MMDDYYYY field is invalid' when i click on save button.
    Is this the problem with versions of Adobe liveCycle designer, Adobe reader or GUI?
    Thanks in advance,
    Ram

    Hi
    Check the format (in the object pallete) of the date field in Adobe liveCycle Designer, If it is not set already set it according to your requirement. then see if it works
    Hope this helps
    Regards
    Amita

  • Viewing and Removing the Time part of the Date field

    Hi,
    I have Date field in a table.
    but in SQL plus when I do
    select date from table
    this gives me only the Date values and not the timestamps in the date.
    I believe Oracle stores 'Date' and 'Time' in fields with Data Type 'Date'.
    How do I print the timestamps also in the SQL query?
    Moreover, if I have to extract the date field, reset the timestamp to 00:00:00, and store back the date field (with 00 time), how do I do that?
    Thanks in advance
    - Manu

    Hi,
    If you want to retry date and time you can:
    SELECT TO_CHAR(DATE,'YYYY/MM/DD HH24:MI:SS') FROM TABLE;
    If you want truncate time when inserting in a table simply use TRUNC function
    INSERT INTO TABLE (DATE) VALUES (TRUNC(YOUR_DATE));
    To extract and insert with time 00:00:00
    INSERT INTO TABLE1 (SELECT TRUNC(DATE) FROM TABLE2);
    I hope this help you.

  • The date field does not appear on my form

    On my saved form, the date fields do not reveal the calendar icon to select a date like it does on the test form. The date field is instead a free text field. Can somebody explain what happened to the date field?
    Thank you.

    Hi,
    If the form is saved as pdf, the date picker is not support in pdf.
    Regards,
    Perry

  • What purpose is the Data field in the registry on an individual file extension exclusion in Endpoint Protection?

    File extension exclusions for System Center Endpoint Protection are at
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Microsoft Antimalware\Exclusions\Extensions
    and consist of a REG_DWORD value, named as a file extension such as .mdf, and a corresponding Data element, which always appears to be 0x00000000
    Can this data value ever be anything else, and if so, what are the possible values and their meanings? If not, I'm curious why not just make it a REG_SZ and leave it blank, rather than a data type that requires a value.

    The data field is always 0x00000000. I think other values would be ignored. Only the Name field seems to be important.
    The funny thing is that the exclusion entry can be a REG_SZ and it will work just the same. In fact, if you use the tool that creates a GPO to deploy EP policy instead of using ConfigMgr, the entries are created as REG_SZ instead of DWORD.
    I'm not sure why both methods are used, but the antimalware engine seems to interpret them the same.

  • How to set the data fields column wide at sqlplus

    Dear Sir/Madam
    I would like to know how to set the data fields column wide at sqlplus
    Thanks
    Francis

    see
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch6.htm#sthref1131
    and the FORMAT clause of the COLUMN command in
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12013.htm#BACHCABF

  • Extracting Year from the date field

    Hi,
    I want to extract year from the date field... I've tried following code but got the error
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A a
    Please advice
    Thanks in advance

    user12863454 wrote:
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A aThis should work and returns a string.
    What error did you get?
    maybe your column name is wrong? Is it really A_somthing? This is possible but slightly unusual.
    also possible
    select extract(Year from sysdate) from dual;
    /* with your table and column */
    SELECT extract(year from a.A_EXPIRY_DATE) as EXP_YEAR from Table_A a;Edited by: Sven W. on Aug 18, 2010 6:41 PM

  • Find gap between two dates from table

    Hello All,
    I want to find gap between two dates ,if there is no gap between two dates then it should return min(eff_dt) and max(end_dt) value
    suppose below data in my item table
    item_id    eff_dt           end_dt
    10         20-jun-2012     25-jun-2012
    10         26-jun-2012     28-jun-2012 There is no gap between two rows for item 10 then it should return rows like
    item_id eff_dt end_dt
    10 20-jun-2012 28-jun-2012
    item_id    eff_dt           end_dt
    12         20-jun-2012     25-jun-2012
    12         27-jun-2012     28-jun-2012 There is gap between two rows for item 12 then it should return like
    item_id eff_dt end_dt
    12 20-jun-2012 25-jun-2012
    12 27-jun-2012 28-jun-2012
    I hv tried using below query but it giv null value for last row
    SELECT   item_id, eff_dt, end_dt, end_dt + 1 AS newd,
             LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
              co_code, item_id) AS LEAD,
             (CASE
                 WHEN (end_dt + 1) =
                        LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
                         co_code, item_id, eff_dt)
                    THEN '1'
                 ELSE '2'
              END
             ) AS new_num
      FROM item
       WHERE TRIM (item_id) = '802'
    ORDER BY ctry_code, co_code, item_id, eff_dtI m using oracle 10g.
    please any help is appreciate.
    Thanks.

    Use start of group method:
    with sample_table as (
                          select 10 item_id,date '2012-6-20' start_dt,date '2012-6-25' end_dt from dual union all
                          select 10,date '2012-6-26',date '2012-6-26' from dual
    select  item_id,
            min(start_dt) start_dt,
            max(end_dt) end_dt
      from  (
             select  item_id,
                     start_dt,
                     end_dt,
                     sum(start_of_group) over(partition by item_id order by start_dt) grp
               from  (
                      select  item_id,
                              start_dt,
                              end_dt,
                              case lag(end_dt) over(partition by item_id order by start_dt)
                                when start_dt - 1 then 0
                                else 1
                              end start_of_group
                        from  sample_table
      group by item_id,
               grp
      order by item_id,
               grp
       ITEM_ID START_DT  END_DT
            10 20-JUN-12 26-JUN-12
    SQL> SY.

  • How do i insert a drop down calender to insert the date field.

    How do i insert a drop down calender to insert the date field i my create a form

    Hi,
    You can use the date object FormsCentral provides. When you test the form in browser, the date field will show a pulldown calendar when clicked upon.
    Thanks,
    Wenlan

  • I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    click and hold on one cell, then drag to select the range, then release, then type the delete key.  Only inlude cells in the range you do not want to keey the contents of the cell.  You can remove one-off cells by holding the command key and clicking cells to add or remove as needed.
    You can download the Numbers users guide here:
    http://support.apple.com/manuals/#productivitysoftware

Maybe you are looking for

  • Is there an equivalent statement in Java for this PL/SQL stmt?

    Hi, I want to know if there is an equivalent statement in java for this PL/SQL statement: IF strTok IN('COM-1','COM-2','COM-3') Then /* Do Something */ End If; I tried using : // This is giving me errors.. if (strTok.equals(("COM-1") || ("COM-2") ||

  • Downloaded files with ActiveX not displays using Windows 8 and IE 11

    We are using ActiveX for downloading file from our server. After downloading ActiveX decrypt downloaded files. ActiveX works fine with all other IE versions but in case of IE 11, when we download the files ActiveX doesn't throw any error, but when we

  • Error in Sender JDBC communication channel

    Dear All, We have an interface in which we are fetching data from SQL database through sender JDBC communication channel. Last week SQL server was upgraded from 2000 to 2008 and the communication channel has stopped working and is giving the followin

  • How to generate the BPEL interface from XSD?

    I am new to the BPEL. How to generate the BPEL interface from XSD because I need the inputed payload to have a complex type instead the simple string? Thank you

  • Drop shadow not working

    Hi, It's very strange. I just applied a drop shadow to a shape and then went to apply to another and suddenly it's not doing anything. What's going on? Should I just restart or could it be something else? Thanks!