Setting a sequential number to records placed into groups?

Hello I have one table with records which can be grouped and I want to know if I can set an ordinal number to each record and when the group breaks set 1 again to the first record of the group and then 2 to next...3 to next....until group breaks again.....
the first thing I need is order the records according the group then number each record inside the group sequentially from 1 to ..n (numbers or records of the group).
Can I do this???
Thanks in advance

Hello
you can use the row_number analytic function
WITH gp AS
(   SELECT 1 id, 1 family_id,to_date('29/06/1966','dd/mm/yyyy') dob from dual union all
    SELECT 2 id, 1 family_id,to_date('22/06/1986','dd/mm/yyyy') dob from dual union all
    SELECT 3 id, 2 family_id,to_date('04/03/1975','dd/mm/yyyy') dob from dual union all
    SELECT 4 id, 3 family_id,to_date('01/04/1990','dd/mm/yyyy') dob from dual union all
    SELECT 5 id, 3 family_id,to_date('10/01/1996','dd/mm/yyyy') dob from dual union all
    SELECT 6 id, 3 family_id,to_date('21/09/2000','dd/mm/yyyy') dob from dual
SELECT
    id,
    family_id,
    dob,
    ROW_NUMBER() OVER(PARTITION BY family_id ORDER BY DOB) rn,
    ROW_NUMBER() OVER(PARTITION BY family_id ORDER BY DOB DESC) rn_desc
FROM
    gp
        ID  FAMILY_ID DOB                          RN    RN_DESC
         1          1 29-JUN-1966 00:00:00          1          2
         2          1 22-JUN-1986 00:00:00          2          1
         3          2 04-MAR-1975 00:00:00          1          1
         4          3 01-APR-1990 00:00:00          1          3
         5          3 10-JAN-1996 00:00:00          2          2
         6          3 21-SEP-2000 00:00:00          3          1
6 rows selected.which gives you the ability to generate the numbers as you have requested. The important parts are the PARTITION which is the group of rows over which the function will be applied, and the ORDER BY which will determine the order in which the function is applied to those rows. You can see that I called the function twice, once with ORDER BY DOB and the other with ORDER BY DOB DESC and the difference in the output.
HTH
David

Similar Messages

  • Total number of records loaded into ODS and in case of Infocube

    hai
    i loaded some datarecords from Oracle SS in ODS and Infocube.
    My SOurceSytem guy given some datarecords by his selection at Oracle source system side.
    how can i see that 'how many data records are loaded into ODS and Infocube'.
                     i can check in monitor , but that not correct(becz i loaded second , third time by giving the ignore duplicate records). So i think in monitor , i wont get the correct number of datarecords loaded in case of ODS and Infocube.
    So is there any transaction code or something to find number records loaded in case of ODS and Infocube .
    ps tell me
    i ll assing the points
    bye
    rizwan

    HAI
    I went into ODS manage and see the 'transferred' and 'added' data records .Both are same .
    But when i total the added data records then it comes 147737.
    But when i check in active table(BIC/A(odsname)00 then toal number of entries come 1,37,738
    why it is coming like that difference.......
    And in case of infocube , how can i find total number of records loaded into Infocube.(not in infocube).
               Like any table for fact table and dimension tables.
    pls tell me
    txs
    rizwan

  • How can I see in my address book all contaacts that have not been placed into groups?

    How can I see in my address book the contacts that have not been put into groups?

    The best way to do that is create a new "smart group" with the following:
    This way you can identify those without a group and drag them to one.
    Regards,
    Captfred

  • Count the number of records in a group

    Hi ,
    My requirement is to display in the BI reprt - records in Order Entry Line Items based on several conditions on the fields.
    If the above conditions do not returm any records ,show an error message - NO DATA FOUND.
    1.checked in standard RTF templates where its a simple example as if :not(//servicereq).
    But ,my RTF has serveral conditions on the group.
    2.Is there a way to take a count of records in the group which statisfy the given condotions,so that I can checkif count = 0 .dislay message.
    Apreciate your help.
    Regards.

    Ummmmm...no I didn't, hate to admit it.
    Added the declaration to the 2 percentage formulas. Now I do get results for the percentage...they are just wrong. Only pattern I've found is that if the running total of Int or Ext is 1, the percentage is 11.39. If it is 2, the percentage is 22.78 and so on.
    Each percentage is a multiple of 11.39 depending on the respective running total calculation. Maybe you can see what I have obviously missed.
    NAME........TOTAL.......TOTAL Int........% Int........TOTAL Ext........%Ext
    Burberry........20..............4..................45.56.............16 ..............182.23
    Cellarosi.......11..............1 .................11.39.............10................113.90
    Chalkley.......19..............2..................22.78.............17................193.62

  • I have used a 'for loop' to create an array of output data, however I want the each of the data sets from the array to be placed into a 1-D array. How do I concatenate the output of the for loop into a 1-D array?

    I am using this to create a data set that will be passed as an anolog output therefore it needs to have the correct array dimensions to go into the analog write vi.

    I'm updating my request... I've figured out how to do this by copying an example that uses a simple FOR loop (as seen in the attached current version of my VI). My question now becomes this: Is there a way to save the Y values corresponding to those X values into two more arrays? That is, just for argument's sake, let's say I took the first 100 elements from the X array, and found them to be positive. Then I would like to take the first 100 elements of the Y array and put them into a 'Y Values for X > 0' array. ...And likewise with the negative X values, they should have a separate array of corresponding 'Y values for X < 0' array.
    I can see that I should somehow save the indices of the positive X values from the large arrray wh
    en I sort them out, and use those indices to pick out the elements from the main Y array with the same indices.
    I just can't seem to set up the code necessary to do this. ...Can anyone help, please?
    Attachments:
    Poling_Data_Reader_5i.vi ‏79 KB
    30BLEND.txt ‏3 KB

  • ICloud Contacts Deleted When Placing Into Group

    I am using iCloud for my contacts.  In Outlook I created a new group for my contacts.  I then dragged contacts from the main Contacts in iCloud to the new group, Now the contacts are gone.
    What happen to my contacts and how do I get them back?

    You probably dragged them to a local group thus removing them from iCloud.

  • How to restrict the number of Records into the Table?

    Is there any way that I can restrict the number of records can be entered into the table?
    For example I have created a table TAB1 with size category 0( zero).
    User dont want to enter more than 100 values, How to restrict the number entries? Whether Basis can do it?
    Regards,
    Prathap

    Hi Prathap,
    You can write a code in table maintenance events to restrict the number of Records added into the Table to constant.
    Solution:
    Se11 -> enter table name (TAB1) -> F6 -> Utlities -> Table maint. generator -> Envirnment -> modification -> events -> write here the form routine name.
    Double click on routine name. You will get into include section of the code. Write here code like:
    IF current_rec_num > 100.
       messgae error 'Entry restriceted to 100'
    ENDIF.
    Somewhat this way you can achieve your target.
    Regards,
    Sachin

  • How to set default number of records shown in report table?

    How can I set the default number of records shown in a table report?

    This is how report attributes page should look like and there is the number of rows where you enter whatever you need:
    http://i44.tinypic.com/es95bn.gif
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Sequential Number into Dimension BPC NW

    Hi expert
    i hope that you can help me, i need to create a sequential number as a Member into a one Dimension in order to identify any load data in our planning process, this number have to be create when the user send data to applitation by data input schedule.
    Please any idea to do that.
    Regards

    Thanks again,
    I have also created another property in order to group all the values I want to consider, but the script logic delivers an exception and it does not work.
    Example:
    Dimension: DIM
    ID       PROP1    GROUP
    A        10           Y
    B        13           Y
    C        17           Y
    If I need to multiply by 2 the value in the dimension PROP1, I have tried the following:
    *SELECT(%VAR%,"[PROP1]",DIM,"[GROUP]="Y"")
    *WHEN DIM
    *IS<>""
    REC(EXPRESSION=%VAR%2)
    *ENDWHEN
    However, the system delivers an exception error: UJK_VALIDATION_EXCEPTION: Unknown DImension Name in Keyword:¨3
    In the other hand the following gets saved and processed correctly:
    *SELECT(%VAR%,"[PROP1]",DIM,"[PROP1]="10"")
    *WHEN DIM
    *IS<>""
    REC(EXPRESSION=%VAR%2)
    *ENDWHEN
    I am using BPC NW 7.5 SP03 but I was not able to find an OSS Note regarding this.
    Many thanks in advance
    Regards
    Dani

  • Setting maximum number of records per page

    Hi All,
    Can anyone tell me how can i set the maximum number of records that should be printed per page in a XML REPORT. How can i write the XML tag for this.
    thanks in advance,
    siddam

    Hi ,
    Please check bi publisher blog from TIM.
    http://blogs.oracle.com/xmlpublisher/2007/03/27
    it will help you out.
    Regards
    Ratnesh

  • Number of records in setup tables

    Hi all,
    How do we find out the number of records extracted into setup tables ?
    Thanks in advance
    Kiran

    Hi Kiran,
    You can check in the RSA3 for the data source.
    In TA NPRT check for the no.of records and then cross check in SE16.
    Assign points if it helps
    Regards,
    Sinivas
    Message was edited by:
            Srinivas
    Message was edited by:
            Srinivas

  • REPORT BUILDER: MAX. NUMBER OF RECORDS PER PAGE

    Dear Consultant,
    Using DEVELOPER 2000 R2.1 REPORT BUILDER, is there any way to set the " MAXIMUM NUMBER OF RECORDS PER PAGE" dynamically by user input when calling the report, without the need to modify the report at Design time and recompile it?
    Thanks for your help.
    Ghia Haidar
    Developer
    Astrolabe IT - Professional Consultants
    Beirut, Lebanon
    Phone: + 961 1 841.050
    Fax: + 961 1 841.055 www.astrolabe.com.lb
    null

    Refer Manish question.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Ali DHAINI ([email protected]):
    Dear Consultant,
    Using DEVELOPER 2000 R2.1 REPORT BUILDER, is there any way to set the " MAXIMUM NUMBER OF RECORDS PER PAGE" dynamically by user input when calling the report, without the need to modify the report at Design time and recompile it?
    Thanks for your help.
    Ghia Haidar
    Developer
    Astrolabe IT - Professional Consultants
    Beirut, Lebanon
    Phone: + 961 1 841.050
    Fax: + 961 1 841.055 www.astrolabe.com.lb
    <HR></BLOCKQUOTE>
    null

  • Record directly into iMovie?

    I was wondering if I could set up a camera, and record directly into iMovie. I have a long program I need record, and would love to record (import) directly into iMovie.

    Yes you can. But there may be occasional short pauses while your Mac "takes a breath" and indexes what it's storing on your hard disc, etc.
    Remember that DV video takes up about 13 gigabytes of space per hour, so you'll need that much free space on your disc per hour of recording, and keep about 10% of your total hard disc space free, so that your Mac can still do its internal housekeeping.
    You'll need, of course a camcorder with a FireWire/DV/i.Link connection (..all the same thing; just different names for it!..) which generally means a tape-based miniDV camcorder.
    (..Although hi-def HDV camcorders have the same FireWire connection, and record onto the same miniDV tape, there's quite an 'overhead' of processing power which your Mac requires in order to convert the incoming hi-def video into the 'Apple Intermediate Codec' format which lets iMovie edit hi-def, so I'd stick with standard-definition DV if I were you!..)*
    Depending on the make and model of camera, you may need to put a tape in the camera - or not - and switch it to either Record or VCR mode. (..In a quick test here I've just turned on my Sony camera in 'Camera' mode with a FireWire cable connected, and iMovie is displaying the picture from the camera, and imports it when I click iMovie's "Import" button..)
    "..I have a long program I need record.." ..erm, if you're pointing it at a TV screen to record that, you'd want the camera on some sort of support, and - if you have Manual Focus - you may want to de-focus slightly to avoid the moiré pattern which you might get from tightly focused dots (pixels) on the screen. You'd also want to adjust the camera's White Balance so that the screen looks the right colour!
    *P.S: hi-def HDV takes up more than 13GB per hour, so if you were to use hi-def HDV you'd need to allow much more (..up to 4x more..) hard disc space per hour of recording!

  • How to get the number of records of a streaming result set

    Hi guys.
    So if it wasn't a streaming result set, I would have done this:
    {noformat}myResultSet<code class="jive-code jive-java">.last();
    {color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
    </code>myResultSet<code class="jive-code jive-java">.beforeFirst();
    </code>{noformat}
    but being a streaming result set, beforeFirst() throws an exception...
    So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.

    JoachimSauer wrote:
    vanwil wrote:
    you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
    If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
    Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
    No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
    java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on  any active result sets before attempting more queries.

  • How to set the number of records displayed at run time

    Is it possible to set the number of records displayed block property at run time? The built-in 'GET_BLOCK_PROPERTY' can retrieve the number of RECORDS_DISPLAYED. But I can't find SET_BLOCK_PROPERTY to set this property. Is there anyway I can set this property programmatically? Thanks for any suggestions!

    Bookmark Go to End
    goal: How to vary the number of records displayed in a block
    programmatically
    fact: Oracle Forms Developer
    fix:
    Block property 'Number of Records Displayed' can not be changed during runtime
    using SET_BLOCK_PROPERTY. However, it is still possible programmatically change
    the visual appearance of the form so that it creates effect of changing this
    property. To achieve such an effect follow these steps:
    1. in Forms Builder, in the multirecord block define the new set of items.
    The simplest way is to copy/paste the original item and rename created item.
    2. set properties of these new items so that they are the same as the properties
    of the original items. If these new items were copied from original items
    then properties are already the same. Modify following properties
    'Database item' on new items to value 'No'
    'Synchronize with item' to the value of the original item
    'Number of Items Displayed' to desired value.
    'Visible' to 'No'
    In other words, these new items are mirrors of original items.
    3. code event, which is meant to trigger the change in block appearance.
    This code should use SET_ITEM_PROPERTY built-in to set properties
    like 'VISIBLE', 'ENABLED', 'NAVIGABLE', 'UPDATE_ALLOWED' and others
    to desired value for items which are about to be displayed, then
    move cursor to one of these just displayed items with GO_ITEM built-in
    and then hide the previously displayed items.
    Example:
    Assume that the block is built on SCOTT.DEPT schema. Following will
    change the set of displayed items
    set_item_property('dept.mdeptno',visible,property_true);
    set_item_property('dept.mdname',visible,property_true);
    set_item_property('dept.mloc',visible,property_true);
    set_item_property('dept.mdeptno',enabled,property_true);
    set_item_property('dept.mdname',enabled,property_true);
    set_item_property('dept.mloc',enabled,property_true);
    set_item_property('dept.mdeptno',update_allowed,property_true);
    set_item_property('dept.mdname',update_allowed,property_true);
    set_item_property('dept.mloc',update_allowed,property_true);
    set_item_property('dept.mdeptno',navigable,property_true);
    set_item_property('dept.mdname',navigable,property_true);
    set_item_property('dept.mloc',navigable,property_true);
    go_item('dept.mdeptno');
    set_item_property('dept.deptno',visible,property_false);
    set_item_property('dept.dname',visible,property_false);
    set_item_property('dept.loc',visible,property_false);
    Regards,
    Monica

Maybe you are looking for

  • Windows Vista not loading IPOD in itunes or explorer HELP!!!

    Family just purchased a new HP pavillion w/ vista. I, myself, have a mac - i am LOST! We installed the latest ITUNES and checked all the drivers and every other option suggested online. We just can't get the ipod to be recognized on vista. The ipod i

  • Unable to Create Entity Model from existing oracle database

    Hi, I am using Visual Studio 2013, .net framework 4.5, entity framework 5.0 and oracle 11g database. Issue Description: I need to develop WCF service to exposing the account information which needs to get the data from 20 oracle tables. Trying to cre

  • My unlocked I phone 6 did not work in saudi arabia

    I bought an I phone 6 from U.S. unlocked spring carrier. According to customer service representative, this carrier would be the best for the 4G speed. When I came back home and tried to use an SIM from STC, it did not work. I wonder if I should retu

  • Links stop working

    I created a link in a PDF to open a file and it worked just fine. Now after several Adobe updates they stopped working both using Acrobat 8 Pro and Reader 9. I checked the link and in the link it points to the correct location of the file on the hard

  • Urgent,i lost 700 msgs bcoz of z software updates

    hey all pls urgent i need a help,when i update my phone nokia 6680 to transfer my msgs to pc i found after updating the phone that there s no msgs in my inbox (in my cellular) i want them back plsssssssssssssssssssssssssssssssssssssssssssssssssssssss