How to get the result of these data

Hi all

I have a following data. And I need the output as follows.

If one of the Intr_num is missing so I need the output to be formatted the next row.

I tried this using the row_number() but could not able to achieve the result. Is there any other function or analysis features to use.

with t as 
(
  select 10001 id, 5004 Intr_num from dual union all
  select 10002,5005 from dual union all
  select 10003,5006 from dual union all
  select 10004,5007 from dual union all
  select 10006,5009 from dual union all
  select 10007,5010 from dual union all
  select 10010,5013 from dual union all
  select 10011,5014 from dual union all
  select 10012,5015 from dual union all
  select 10013,5016 from dual union all
)
select * from t;

OUTPUT:

Intr_num
5004 - 5007
5009 - 5010
5013 - 5016


Kind regards

SID

Hello

ROW_NUMBER is the right function to use:

WITH got_dif AS

(

SELECT intr_num

, intr_num - ROW_NUMBER () OVER (ORDER BY intr_num) AS dif

T

-WHERE... - If you need any filtering, put it here

)

SELECT MIN (intr_num) | ' - '

|| MAX (intr_num) AS intr_num_range

OF got_dif

GROUP BY dif

ORDER BY dif

;

Tags: Database

Similar Questions

  • How to get the result of the query?

    I'm looking to get output something like this...

    If a profile exists on the Pb, I need Exists in the colum

    PROFILE_A EXISTS

    PROFILE_B DOES NOT EXIST

    PROFILE_C EXISTS

    Select distinct profile

    decode (profile, "PASSWORD_PROFILE", "EXISTS", 'THERE is NO') 'STATUS '.

    of dba_profiles;

    How to get the above result? Anyone?

    In the first query, you can add any profile you want to check, and then try the below

    WITH qry1 AS (SELECT profile 'PROFILE_A' FROM dual

    UNION ALL

    SELECT "PROFILE_B" FROM double

    UNION ALL

    SELECT 'DEFAULT' double)

    SELECT the profile

    CASE WHEN EXISTS (SELECT 1 FROM dba_profiles dp

    WHERE dp.profile = q1.profile)

    THEN "EXISTS."

    OTHERWISE "NOT EXIST".

    The END as status

    OF qry1 q1;

    OUTPUT:-

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

    SQL > WITH qry1 AS (SELECT profile 'PROFILE_A' FROM dual

    2. ANY TRADE UNION

    3. SELECT 'PROFILE_B' FROM dual

    4 UNION ALL

    5. SELECT 'DEFAULT' double)

    6. SELECT profile,

    7 CASE WHEN EXISTS (SELECT 1 FROM dba_profiles dp

    8 WHERE dp.profile = q1.profile)

    9 THEN 'EXISTS '.

    10. OTHERWISE "NOT EXIST".

    11 FINISSENT AS status

    Qry1 q1 12;

    PROFILE STATUS

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

    PROFILE_A DOES NOT EXIST

    PROFILE_B DOES NOT EXIST

    DEFAULT VALUE IS

  • How to get the multiple layers of data

    Hello

    I imported two jpg files into a single composition. Please follow this procedure...

    1 created a composition, say his name testCompo

    2 imported a file1.jpg in the file-> Import-> file draft

    3 imported a file2.jpg in the file-> Import-> file draft

    4. drag the two files, file1.jpg and file2.jpg, in the testCompo

    Now, I have two layers (it is file1.jpg and nested are file2.jpg) in my testCompo. How can I get the information in pixels or pixel data of the

    the two images (IE, I mean layers).

    I knew that params [0]-> u.ld is the first data layer in

    () EntryPointFunc
    PF_Cmd cmd,
    PF_InData * in_data,
    PF_OutData * out_data,.
    PF_ParamDef * params [],.
    PF_LayerDef * output,
    void * extra)

    So what about other data layer? Then, finally how can we get the multiple images/layers data in AE?

    Thanks in advance!

    It's the thing.

    You must have a param layer (let's say it's param number 3).

    Use this param to select any layer of the model.

    Now you checkout param 3.

    what you get is a paramDef structure containing the pixels of the layer 3 Advanced param to.

    you will find this information at:

    paramDef-> u.ld.data (or something close to that. I do not have in front of me)

    This way the jpg1 affect can get jpg2 pixels and jpg3. any layer in the comp.

  • How to get the results of the UK instead of the default USA?

    I live in the United Kingdom and would like to be able to search for UK results. for example, Amazon UK results when I search a product, etc.
    with the option of a search in the world so I don't get the results I want

    To add plugins to search for sites such as Amazon.co.UK and Google.co.uk to Firefox, open this page in Firefox and then search or click the sites that interest you: http://mycroft.mozdev.org/

    When you click on one of the listed search plugins, Firefox will ask you if you want to install it.

    After that, you can open the Firefox Add-ons Manager and click on disable one of the search engine integrated you want to use.

  • How to get the result of the test of CVI DLLs in teststand!

    I write a driver dll to test a source, I want to get the tension of world SERVERS (the instrument of the RS) and I used to call DLLs that written by CVI, teststand

    My question is what is the best way I can get the result of the test and show the user to teststand. the code below is fair? When I used to call this dll document, teststand

    "" I just get the result by setting in TS.this is a good meathod, and what should you do in teststand, I put the "outputVoltageV" point to an object?

    /*===========================================================================*/
    / * Function: read voltage/current output * /.
    / * End: this function returns the output and actual output voltage * /.
    / * current instrument.                                      */
    /*===========================================================================*/
    ViStatus _VI_FUNC rsngsm_datReadOutput (ViSession instrSession,
    ViPReal64 outputVoltageV, ViPReal64 outputCurrentA, ViPBoolean statusPeakCurrent)
    {
    ViStatus rsngsm_status = VI_SUCCESS;
    Bruno buf [BUFFER_SIZE];
    ViInt32 retCnt;
       
    FMT (buf, "%s<>
    If ((rsngsm_status = viWrite (instrSession, buf, NumFmtdBytes (), & retCnt))<>
    Return rsngsm_status;
           
    If ((rsngsm_status = viRead (instrSession, buf, 50, & retCnt))<>
    Return rsngsm_status;
    If (Scan (buf, "%s > %f [p2];")) %f [p2]; %i [b2] ", outputVoltageV, outputCurrentA, statusPeakCurrent). = 3)
    Return rsngsm_status;
           
    Return rsngsm_status;
    }

    sean_tan,

    Yes, you just pass a value of digital TestStand (e.g.; locals.number).

    If you use the adapter of the ICB, it might make more sense that you can use the Flexible DLL adapter for this type of function, that you do not use the standard settings of tTestData and tTestError. While TestStand will correctly recognize the function prototype, you want to make sure you that include the type library of your function Panel (you will need to create one if you have not already done so) in settings target of LabWindows / CVI-> type library.

    I hope this helps.

    -Jack

  • How to get the Organizer"and"Accepted"data from a BlackBerryEvent

    Hi all

    -J' I send an invitation to the device of BB from Outlook
    -Once received, accept the appt to the BB email application

    When I view the appointment in the native calendar of BB, I can see the "Organizer" fields and "accepted."

    How can we get these data "Organizer" and "Accepted" to a BlackBerryEvent we will get only the PARTICIPANTSin an event.

    Using String email is event.getString(BlackBerryEvent.ATTENDEES,i);.

    any help in this please.

    Thank you

    Gerard

    No, you can get a list of the names of the participants, but not their status.

  • Not sure how to get the result that I need.

    Hi all

    I'm not a very good programmer, but I'm learning so please bear with me.

    My problem is that I need to be able to create a page that we can imput two dates and get all the items in our database which are equal or between imputted dates and be sent to the page.

    The part of sql is not my problem, but I'm not sure on how to create the page with in the date boxes.

    As it is now I have created the page, but it is retreving all elements of my table and comes it a grid of smiple and the output how many entries table for this is manageable.

    So, if someone can help me or point me in the right direction that would be great.

    Thnaks

    Pat

    Basis of a form.

    Basis of a SQL clause

    
      SELECT aField,bField,cField
      FROM aTable
      WHERE aDateField BETWEEN
               AND
              
    
    

    There is much for you to learn and understand to make a function and a business page.  But you should get at least close to return results.

  • How to get the difference of two dates in months

    Dear friends,

    I have 4 items on my page.

    2 entered message text (value of loan, monthly deduction)

    2 are message style fields (start date, end date)

    I need to get the difference from above 2 dates in no.. of months. (for example say N)

    So with N, loanvalue should be divided and populated as monthly deduction.

    I tried this way, but not able to get the difference of dates

    {if ("populateMonthlyDeduction". Equals (PageContext.GetParameter (EVENT_PARAM)))}

    System.out.println ("enter populateMonthlyDeduction loop1");

    String xxDeductionStartDate = vo.getCurrentRow ().getAttribute("DeducStartDt").toString ();

    System.out.println ("xxDeductionStartDate is:" + xxDeductionStartDate);

    TXN OADBTransaction = am.getOADBTransaction ();

    java.sql.Date DeductionSDate = null;

    java.sql.Date DeductionEDate = null;

    if(xxDeductionStartDate!=null)

    {

    java.sql.Date startDate = txn.getOANLSServices () .stringToDate (xxDeductionStartDate);

    DeductionSDate = startDate;

    System.out.println ("DeductionSDate is:" + DeductionSDate);

    }

    String xxDeductionEndDate = vo.getCurrentRow ().getAttribute("DedEndDt").toString ();

    if(xxDeductionEndDate!=null)

    {

    java.sql.Date endDate = txn.getOANLSServices () .stringToDate (xxDeductionEndDate);

    DeductionEDate = endDate;

    System.out.println ("DeductionEDate is:" + DeductionEDate);

    }

    int difInDays = xxDeductionEndDate-xxDeductionStartDate; -Please correct me

    How reach it .plz help.

    Thank you

    Aravinda

    I used a custom like this method and calls this method daysBetween PFR.

    I got it. Thanks to you all.

    public int daysBetween(As Date, Date etDate)

    {

    return (int) ((etDate.getTime () - stDate.getTime (()) / (1000 * 60 * 60 * 24));

    }

    If ("populateMonthlyDeduction". Equals (PageContext.GetParameter (EVENT_PARAM)))

    {

    System.out.println ("enter populateMonthlyDeduction loop1");

    String dedStDt = vo.getCurrentRow ().getAttribute("DeducStartDt").toString ();

    String dedEndDt = vo.getCurrentRow ().getAttribute("DedEndDt").toString ();

    If (! dedStDt.Equals (null) &! dedEndDt.equals (null))

    {

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

    Date sdate = new Date();

    Date edate = new Date();

    String sdate1 = null;

    String edate1 = null;

    try {}

    sdate = dateFormat.parse (dedStDt);

    EDATE = dateFormat.parse (dedEndDt);

    SimpleDateFormat dateFormat1 = new SimpleDateFormat("dd-MMM-yyyy");

    sdate1 = dateFormat1.format (sdate);

    edate1 = dateFormat1.format (edate);

    int days = daysBetween(sdate, edate);

    int diffInMonths = days/30;

    System.out.println ("days is:" + days);

    System.out.println ("diffInMonths is:" + diffInMonths);

    String sTotValueTuitionFees = vom.getCurrentRow ().getAttribute("TotValueTuitionFees").toString ();//pageContext.getParameter("LoanValue").toString();

    int iTotValueTuitionFees = Integer.parseInt (sTotValueTuitionFees);

    int iMonthlyDeduction = iTotValueTuitionFees/diffInMonths;

    String sMonthlyDeduction = String.valueOf (iMonthlyDeduction);

    System.out.println ("iMonthlyDeduction is:" + sMonthlyDeduction);

    OAMessageStyledTextBean bMonthlyDeduction = (OAMessageStyledTextBean) webBean.findChildRecursive ("MonthlyDeduction");

    bMonthlyDeduction.setValue (pageContext, sMonthlyDeduction);

    }

    catch (ParseException exception) e

    {

    }

    }

    }

  • How to get the result of the assessment?

    According to Adobe Captivate online help, "use the assessment mode when you want to test how the user has understood a procedure. You can set a score for every correct click. "

    But how the person who makes the assessment of the result (score/percentage) GET?

    Go to the Quiz settings and select the option to show the Score at the end of the Quiz.

    A new Quiz results slide is added at the end of your quiz so that learners can see their quiz results.

  • How to get the required connection pool data source?

    Hi we have created two pools of connections with two different userid to restrict access to the database. now I have 2 pools. so if I want to get the connection to a specific pool how to do this?

    Use the JNDI string. When you created your pools you created the jndi names. So when connecting to the data source, you specify jndi. That's how.

    Your postal code if you have a problem.

  • How to get the result on the same page

    How to capture the data entered by the user on the page and fill in the result.

    for example: -.

    Data: -.

    fieldA = abc

    fielsb = efg

    Feildc = SMC

    result = abc-efg-chd

    I intend to write this logic in controller...

    If one of you having same logic please give me... Thanks a lot guys!

    Edited by: user11929230 (Pavan) October 14, 2009 08:46

    Pavan,

    I take a simple example, I hope it's clear your doubts.

    In Jdev create 3 new MessageTextInput with VO no attribute.

    Let's say it would be item1 and item2, item3

    And if I click on save button I want to concatenate the value of item1 and item2 in item3. As A and B in item3 in so AB

    Now in the ProcessFormRequest controller I'll write.

    If (pageContext.getParameter ('save')! = null)
    {
    String a = pageContext.getParameter ("item1"); Item1 here is the Id of the item that you created in JDEV
    String b = pageContext.getParameter ("item2");

    Txt OAMessageTextInputBean = (OAMessageTextInputBean) webBean.findChildRecursive ("item3");
    txt.setText(pageContext,a+"-"+b);
    }

    Thank you
    -Anil

  • How to get the result

    Hi all

    Let me explain my requirment.

    I created a custom workflow where the order goes to the approver for counterpart he can accept or reject that.

    If the notification that the approver receives have a result with approve and reject values. The notification activity, I've written a procedure that will update the database columns that are based on the result.

    But how do we get this result value

    I need something like below

    x_result: result of get value =
    If x_result = "Approve" then
    Update of table with approved status
    on the other
    Update of table with the status rejected

    Kind regards
    Kumar.

    Use the RESULT attribute

    x_result: = Wf_Notification.GetAttrText (, 'RESULT');

  • How to get the row of Table data in the pop up window

    Hello world

    I'm working on Jdeveloper 11.1.1.4 and I got a requirement when there is a delete as a column in a Table in the ADF. When the user clicks on delete button that I need to display a confirmation message "You want to remove from the Table" OK CANCEL.

    If the user clicks the OK button, then I need to update the value of last_update_by to the one who connects and then deletes the line from the user interface but at the level of the table of database, that line will be there.

    Do I want to get the line given in the confirmation message pop-up and to add rowdata.setAttribute(last_update_by,'') in the class of the action of the OK button.

    I could get the rowdata table in class action OK button but when I do rowdata.setAttribute(last_update_by,'') that class action it gives me null pointer exception.

    Can someone help me with valuable suggestions?

    Thank you

    You may need to check {: identifier of the thread = 2223878} thread

  • How to get the names of all data centers in vSphere

    Hello

    The following code retrieves the path of ful of VMDK files.

    How can I get this info to all the domain controllers in my environment instead of questioning a DC at a time?

    CODE:

    Get-data center $DC | Get-Datastore. Where-Object {$_.} {Name - notlike "DataStore1 *"} |
    Sort-Object-property name.
    Select-Object - property name,
    @{Name = "CapacityGB"; Expression = {[Math]: tour ($_.)} (CapacityGB, 0)}},
    @{Name = "UsedSpaceGB"; Expression = {[Math]: tour ($_.)} CapacityGB-$_. (FreeSpaceGB, 0)}},
    @{Name = "FreeSpaceGB"; Expression = {[Math]: tour ($_.)} (FreeSpaceGB, 0)}},
    @{Name = "UncommittedSpaceGB"; Expression = {}
    If (-not $_.) ExtensionData.Summary.Uncommitted) {}
    0
    }
    else {}
    [Math]: tour ($_.) ExtensionData.Summary.Uncommitted/1GB,0)
    }
    }},
    @{Name = "ProvisionedSpaceGB"; Expression = {}
    $Summary = $_. ExtensionData.Summary
    If (-not of $Summary.Uncommitted) {}
    [Math]: round (($Summary.Capacity-$Summary.FreeSpace)/1GB,0)
    }
    else {}
    [Math]: round (($Summary.Capacity-$Summary.FreeSpace + $Summary.Uncommitted) / 1 GB, 0)
    }
    }},
    @{Name = "PercentageUsed"; Expression = {[Math]: round (100 *($_.)} CapacityGB-$_. FreeSpaceGB) / $_. (CapacityGB, 0)}},
    @{Name = "PercentageFreeSpace"; Expression = {[Math]: round (100 * $_.)} FreeSpaceGB / $_. (CapacityGB, 0)}},
    @{Name = "PercentageProvisioned"; Expression = {}
    $Summary = $_. ExtensionData.Summary
    If (-not of $Summary.Uncommitted) {}
    [Math]: round (100 * ($Summary.Capacity-$Summary.FreeSpace)/$Summary.Capacity,0))
    }
    else {}
    [Math]: round (100 * ($Summary.Capacity - $Summary.FreeSpace + $Summary.Uncommitted)/$Summary.Capacity,0))
    }
    }},
    @{Name = 'MV'; Expression = {[string]: join (';', ($_.))} ExtensionData.Vm | ForEach-Object {Get-View-Id $_}). Name)}}.
    @{Name = "VMDK"; Expression = {[string]: Join (';', (& {}}
    $Datastore = $_
    $Datastore.ExtensionData.Vm |
    {ForEach-Object
    Notice-EEG-Id $_.
    Get-VIObjectByVIView |
    Get-hard drive |
    Where-Object {$_.} FileName-like "* $($Datastore.Name) *"} ".
    }
    }). File name)

    }} | Export-CSV $FileName - NoTypeInformation - UseCulture

    The easiest way is to make equal $DC to ' *'.

  • How to get the reconciliation AD event data using the SQL query.

    Hi all
    I was trying to get all the recon data to target AD Recon of IOM db, but it seems that at the OIM 11 g we have recon not given in the tables: UCR, CRE, etc.. Use tables "RECON_"... ', my question is all no bady has example query to extract data from recon tables?
    The best
    MP

    It should be a matter of linking your reconciliation table of user AD (early RA_) with the RECON_EVENTS of RE_KEY table.

    In my case, I have user OID reconciliation (so my RA_ table will be different to yours) and can use something like:

    SELECT RECON_EVENTS. RE_STATUS, RECON_EVENTS RA_OIDUSER5.*, RA_OIDUSER5 WHERE RECON_EVENTS. RE_KEY = RA_OIDUSER5. RE_KEY;

    Of course, then depends on what information you want to filter and recover.

Maybe you are looking for

  • activating the lltd in windows xp

    I just found out that the lltd is not enabled on my network for xp and vista can communicat with each oter. I'm trying to find out how to make the active lltd. LLTD has been uploaded to the bottom, but does not part.

  • Windows Mail in Windows Vista - the connection to the server failed.

    The connection to the server has failed. Subject 'Test', account: ' WindowsLive Mail ', server: 'smtp.live.com', Protocol: SMTP, Port: 25, secure (SSL):Yes, Socket error: 10060, error number: 0x800CCC0E Here's the error message popped up when I tried

  • M1132 MFP - WINDOWS SERVER 2008

    Hi, I had a LaserJet M1132 MFP printer shared over a LAN network (it is installed on windows server 2008 as the title suggests). When I print a document, I get two different problems: -Pages in landscape orientation is printed with normal orientation

  • My creative cloud is not properly updated and will not uninstall either.

    My creative cloud is not properly updated, so I thought I would try uninstalling and reinstalling. However, it won't let me not uninstall it either because it is said that some software Adobe is already running. I don't see any good running. Suggesti

  • Number of records in the interval of 30 minutes.

    Hi allI'm trying to find the number of records in 30-minute intervals. Having said that, I am discovering many records I get in 30 minutes. In my table, I have a column called 'Last_UPDATE_DATE' with the date and time. Can someone help me, ways to ac