How to find gaps in data?

Hi!
I have the following problem.
Data:
range_id actual_nr
AAA 001AAA
AAA 002AAA
AAA 003AAA
AAA 006AAA
AAA 007AAA
AAA 009AAA
BBB 001BBB
BBB 002BBB
etc.
I have to get report in the following form
from to nr_of_rows
001AAA 003AAA 3
006AAA 007AAA 2
009AAA 1
001BBB 002BBB 2
etc.
As you can see if there is a gap in sequence then I have to calculate how many rows were in sequence before the gap.
Can somebody give me some hints or even working statement?

How's this?
WITH
     Sample_Data
AS
      SELECT 'AAA' range_id, '001AAA' actual_nr FROM Dual UNION ALL
      SELECT 'AAA' range_id, '002AAA' actual_nr FROM Dual UNION ALL
      SELECT 'AAA' range_id, '003AAA' actual_nr FROM Dual UNION ALL
      SELECT 'AAA' range_id, '006AAA' actual_nr FROM Dual UNION ALL
      SELECT 'AAA' range_id, '007AAA' actual_nr FROM Dual UNION ALL
      SELECT 'AAA' range_id, '009AAA' actual_nr FROM Dual UNION ALL
      SELECT 'BBB' range_id, '001BBB' actual_nr FROM Dual UNION ALL
      SELECT 'BBB' range_id, '002BBB' actual_nr FROM Dual
SELECT
     MIN(actual_nr_start)     actual_nr_start,
     actual_nr_finish,
     MAX(Total)
FROM
      SELECT
          range_id,
          MIN(actual_nr)     actual_nr_start,
          MAX(actual_nr)     actual_nr_finish,
          MAX(Level)     Total
      FROM
          Sample_Data
      CONNECT BY
          range_id          = PRIOR range_id
         AND     substr(actual_nr, 1, 3)     = substr(PRIOR actual_nr, 1, 3) + 1
      GROUP BY
          range_id,
          CONNECT_BY_ROOT actual_nr
GROUP BY
     actual_nr_finish
ORDER BY
     SubStr(actual_nr_start, -3),
     actual_nr_start;Message was edited by:
Brian Tkatch 2
consolidated two levels.

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

  • 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 and replace data in form fields in acrobat xi, its not allowing to do so while trying, a

    how to find and replace data in form fields in acrobat xi, its not allowing to do so while trying, asking for adobe livecycle to get installed. please help.

    Easiest way to do it is the following:
    - Open the PDF file in Acrobat.
    - Go to Tools - Forms - More Form Options - Export Data.
    - Save the form data as an XML file somewhere on your system.
    - Open XML the file in a plain-text editor (I recommend Notepad++).
    - Let's say you want to replace all the years in the dates from "2013" to "2014". Do a global Search&Replace of "2013-" to "2014-" (I added the dash just to make sure that only date fields are edited).
    - Save the XML file (maybe under a new name).
    - Go back to the PDF file, and now go to Tools - Forms - More Form Options - Import Data.
    - Select the edited XML file and import it.
    - Done!

  • How to find the creation date for a released requests..

    Hi friends ,
    In se09 tcode , we a date which represents the last changed date .. Now , for a particular Released request i want to find out the Creation date for it . How can i find it . I checked the tables like E070create there also we have requests that not released yet , i have also checked se03 and other tcode and a fn mo dules like TR_READ_GLOBAL_INFO_OF_REQUEST .
    So how to find the creation date for a released requests. Iam waiting for ur inputs..
    Thanks in advance..

    hi,
    Did u found the way to get the request creation date?
    I also need the same information.
    This needed for audit purpose........so it is must.
    Please help me in this.
    Best regards,
    vinod

  • How to find Pick Release Date in O2C Cycle

    Dera All,
    How to find Pick Release date in Order to Cash cylec after we perform the ship confirm Transaction.
    Please advice me as its a requirement from my customer. Pick Release date should come in Report.
    Regards,
    Aditya

    Run the Diagnostic OM order Information report against the order. In the report you can the find the picked date.
    Can I know you are using the transact move order ?
    Thanks

  • 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

  • To know how to find the Creation date, Assignement date and Activation date

    Hi All,
        Can you please guide me to find the answer for the below mentioned questions:
    Apart from Change log ,
    1, Creation date
         May I know is there any approach to find the  Creation date of a particular Pricing condition type.
    2. Assignment date -
        How to find the assignment date of a particular condition type to a pricing procedure.
    3. Activation Date -
        May I know is there any to find out the date of Activation for the Customer hiearchy in T code VDH1N
    Presently I'm working on SAP ECC 6.0For the above question I tried T codes and table but I'm not able to find out exactly. Even in Change logs I'm not able to get it.
      Can you please guide me where I'm missing.
    Thanks in Advance
    Thanks & Regards,
    Pugal

    Hi,
    Something like this
    select table_name, created from user_objects where object_type = 'TABLE'Regards
    Anurag Tibrewal
    Oops: I did not see the requirement correctly. If auditing is not the option for you then logminer (if archive is present) else no other option i can think of.
    Edited by: Anurag Tibrewal on Oct 6, 2009 8:37 PM

  • How to find Validate purchase date my mac book pro.Serial Number  CP********TY3

    how to find Validate purchase date my mac book pro.Serial Number  CP***********TY3
    <Personal Information Edited by Host>

    see More like this to the right of the screen
    https://discussions.apple.com/message/20811606#20811606
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How to find from the data dict if a user has read access on a directory

    How to find "dynamically" if a user has READ access to a directory object.
    I want to know if there is a data dictionary table that holds if a user/schema has read access to a directory object.
    I know there is an dba_directories table and an all_directories table but they dont give information as to which user has read access granted to the directory.

    Not so difficult.
    select  'YES'
       from all_tab_privs A, all_directories B
       where a.grantee = 'USERNAME'
           and a.table_name = b.directory_name
           and b.directory_path = 'PATH YOU ARE LOOKING FOR'
    How to find "dynamically" if a user has READ access to a directory object.
    I want to know if there is a data dictionary table that holds if a user/schema has read access to a directory object.
    I know there is an dba_directories table and an all_directories table but they dont give information as to which user has read access granted to the directory.

  • HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER

    Hi,
           I want to know how to find the last document details based on material number.
    Is there any Functional modulle or BAPI programe?
    i,e, I want know last goods receipt details (MIGO)  based on material number.
    Can u please anybody tell me.
    Thanks,
    S.Muthu.
    Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AM

    Hello.
    Check the BAPI_GOODSMVT_GETITEMS
    -example--
    Get GRs after a specific date for a specific plant/ storage location and movement types
      wa_budats-sign = 'I'.
      wa_budats-option = 'GE'.
      wa_budats-low = '20071201'.
      APPEND wa_budats TO budats.
      wa_plants-sign = 'I'.
      wa_plants-option = 'EQ'.
      wa_plants-low = '1000'.
      APPEND wa_plants TO plants.
      wa_stlocs-sign = 'I'.
      wa_stlocs-option = 'EQ'.
      wa_stlocs-low = '0001'.
      APPEND wa_stlocs TO stlocs.
      wa_mvts-sign = 'I'.
      wa_mvts-option = 'EQ'.
      wa_mvts-low = '101'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '901'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '123'.
      APPEND wa_mvts TO mvts.
      CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
        TABLES
          plant_ra        = plants
          stge_loc_ra     = stlocs
          move_type_ra    = mvts
          pstng_date_ra   = budats
          goodsmvt_header = header
          goodsmvt_items  = item
          return          = return.
    Reward if helpful.
    Cheers,
    George

  • How to find Last Payment date for vendor

    Hi,
    I am working on ALV  Vendor report details.
    1) How to find the last payment date for the vendor.
    2) In input paramter field  
        PARAMETERS: L_FILE  LIKE  RLGRAP-FILENAME.
       I want to validate the user input in the selction screen for downloading the file in the presentation server..
      what is the validation I have to write for the path name.
    pl help me give details.
    Thanks in advance.
    sharma

    1) use table REGUH field ZALDT or VALUT
    2) use fm like EPS_GET_FILE_ATTRIBUTES
    A.

  • How to find unassigned master data text objects in process chain in bi

    Hi
    Please let me know how to find the unassigned master data text objects in process chain.

    hi,
    actually if u want to find that , is ur Unassigned Infoobject in present in process chain or not, , that u can find out just by right
    click on your DTP (master data Txt datasource--> Master data text ), if this is present in Process chain, then on ryt click, the process chain option will be active. by clicking over that u can find the name in which this exists.
    thanks.

  • How to find active master data source in the bw system

    Hi
    Can anyone guide me how to find the active master data source in the bw system

    Hi,
        You can use the table ROOSOURCE. The field ROOSTYPE specifies the type of datasource whether Transaction or attributes or text. You could write an abap program to filter the table and give you only master data datasources.
    Assign points if helpful
    Regards.

  • How do find the build date on my iMac?

    Before I can think about upgrading from 10.6.8, I need to have a mid 2007 iMac or later. How do I find that info. It's not in the system profiler.

    Thanks, this is just what I needed to know. Funny how Apple tells you what you need but does not tell you how to find out what you have. I don't know whats wrong with just using an actual date instead of coding it.

Maybe you are looking for

  • Ps CS5 crashes when opening a new document.

    I have not downloaded any new fonts or software. I have checked for any recent updates, and I used the clean my Mac application to guarantee I have enough memory to run Ps. I also do not have any other program running while I try and open a new docum

  • Com.ibm.xml.parser.Parser Not Found

    Hi, I am getting error of Package not found i.e com.ibm.xml.parser.Parser But i had this package in my libraries and that have been set to project classpath. Still i m getting error , i m totally confused , please tell me how to resolve it I m using

  • Router 3745 itself breaks in many lines (30 modems mica-K56flex)

    Help me please A have router 3745 with 30 modems mica-K56flex. line 97 126 exec-timeout 0 0 no flush-at-activation modem InOut modem autoconfigure type mica-K56flex transport input all transport output all autoselect during-login autoselect ppp line

  • Installing in Mandrake 8.2 problem

    I have a problem installing Sun J2SE SDK in Mandrake 8.2 The error is: Error: could not find libjava.so Error: could not find Java 2 Runtime Environment. I installed JAVA in the directory /usr/local/j2sdk/v1.4.1/ I have already modified my /etc/profi

  • PSE 10 Katalog beschädigt

    Hallo zusammen, ich habe vor ein paar Tagen auf die 10er Version gewechselt (von 6er).  Der Wechsel hat gut funktioniert. Allerdings kann ich die Ähnlichkeitssuche nicht verwenden. PSE beginnt zwar den Index zu erzeugen (bis 100%), bricht dann aber m