How to fetch particular segment of records?

Hi all,
My last question is how to limit the rows returned. This time my question is how to fetch particular segment of records from DB table?
In detail, if one table has 95 records, which method can be used to fetch #71-80 record only, not fetch #1-80 first and abandon the preceeding 70 ones?

There are a few methods:
- Set firstResult and maxResult on the JPA Query, this is normally the best option. Depending on your database this will best optimized to only select these rows.
- Use a Cursor, in EclipseLink 1.1 there are QueryHints for doing this, see org.eclipse.persistence.config.QueryHints.
- Select all of the results, and store them in your app or http session, and scroll through them in memory on next/previous.
- Select just the ids, and store them in your app/page or http session, each page select the batch of object with the ids.
- Use an order-by and critieria to limit your results to a specific amount.
James : http://www.eclipselink.org
http://en.wikibooks.org/wiki/Java_Persistence

Similar Messages

  • How to fetch 2 set of records in MII from SQL procedure

    Hi Experts,
    I am invoking a SQL procedure from MII which return 2 set of records. But at MII I am able to get only first set of records. Is there any configuration required at MII side or SQL side to get both set of records in MII?
    Here is the SQL Query Structure
    Create procedure Sample_Proc
      @Param1 Varchar(10),
      @Param2 varchar(10),
      @Param3 Varchar(20) OUT,
      SET INCOUNT ON;
    AS
    Begin
      *//Selection statements//*
    END
    SP Executing in MII
    Declare @Param1,
      @Param2,
      @Param3,
    Exec Sample_Proc
      @Param1='name',
      @Param2='Id',
      @Param3=@Param3 OUTPUT,
    Select @Param3
    Our SP is returning values (Say Recordset1)based on the input parameters 1 and 2 , along with Parameter3 value(Say Recordset2) in MS SQL server but in MII its returning only the values(Recordset1) ... how to fetch recordset2 values in MII
    I hope MII can return 2 set of records (rowsets) after executing the procedure.
    MII version -> 12.2.3 Build(182)
    Thanks & Regards,
    Rajasekhar Kantepalli

    Hi Swaroop,
    With MII 14.0 SP5 Patch 11, in a transaction, I get following XML output for a query that executes an SP(returning multiple resultSets) :
    And, results in this format can surely be used for further processing in an MII transaction.
    Thanks Rajasekhar, got to know about this because of your query.
    regards,
    Manisha

  • How to fetch some certain records at a time

    Hi everyone,
    I dont know how to fetch some records at a time,
    for some reason,there is not enouht memory.so I cant
    fethch all the records at a time.
    example, every time I only want to fetch 10
    records. Does anyone know that?
    thanks
    Krussi

    I think you may be getting setFetchSize(int) and setMaxRows(int) confused. I may have added to the confusion with my breaking out of the loop comment.
    setFetchSize(int) gives the driver a hint as to how many rows it should store in memory at a time internally, ie. within the driver. It has no real effect on how you write your program at all. Its only purpose is to limit memory usage by the driver. To limit the rows returned, use setMaxRows.
    For example, assume a result set has 20 rows and you use:
    rs.setFetchSize(5);
    while (rs.next()) {
       System.out.println("Rows: " + (++count));
    }  You still get a count from 1 to 20. However, internally the driver is only holding in memory 5 records at a time, after the 5 returned it will discard those and get the next 5. So instead of holding 20 rows, its only holding 5 at a time. If you change rs.setFetchSize(5) to rs.setMaxRows(5) you will only get a count from 1 to 5, the rest are silently discared and rs.next() returns false.
    Check your documentation to see if your driver supports the method. I believe many drivers don't. If not, I believe there is no way around multiple queries. Even if there is no rowid, as long as you order your queries you should be able to start again where you left off.
    Disclaimer: Both drivers I commonly use do not implement setFetchSize(int). Someone let me know if I've fudged something here.
    Good Luck

  • How does jdbc fetch a set of records in oracle

    Hi,
    Oracle does not support server side cursors,if so how does jdbc fetch a set of records(set by setFetchSize(), which is 10 by default) each time I say rs.next().Does this mean Query is re-executed to fetch the next set of records? Can some body throw some light on this?
    thanx in advance
    Gnayan

    You are asking about implementation details of some JDBC driver, but you don't say which one. This makes it very difficult to answer your question. You might want to try asking the question of the people who wrote the driver.

  • Idoc to File -- Records will depend on repetition of particular segment.

    Hi Experts,
    Iam doing a Idoc to file scenario.
    Based on the sales organization(VKORG),i need to create the multiple records in the file.
    For example :
    E1MARAM  0..Unbounded
         |
         |E1MARMM   0..Unbounded
         |
         E1MARMM
         |
         E1MARMM
         |
         E1MARMM
         |
    <b> E1MVKEM   0..Unbounded
         |
         E1MVKEM</b>           
    When E1MVKEM-VKORG = Z200 then i need to create a file with 4 records (for 4 E1MARAM segments 4 records will be created)
    When one more E1MVKEM-VKORG  = Z201 present then we need to create 4 more records for Z201 in the same file.
    So now i will be getting a single file with 8 records.
    Please suggest me how to approach these kind of scenario.
    PS: we are not using BPM in our scenario.
    Thank You.
    Regards
    Seema.

    Hey seema,
    This can be achieved using node function <b>createif</b>.
    Refer this link which help you doing the same
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm
    and also refer stefan's blog
    /people/stefan.grube/blog/2006/01/09/the-use-of-suppress-in-the-xi-30-graphical-mapping-tool
    Hope it helps you
    Regards,
    Ramesh P

  • How to fetch all the records from ztable

    Hi 
    My program is outbound program.
    According to the requirement i have to fetch all the records from ztable which are not tranmitted before to the third party and once the records are extracted and written to output file they will be marked as 'X' in the "status" field of that ztable for the next days run.
    How to fetch the records.Please suggest me.
    Thanks,
    Neelima

    HI,
    Fetch all the records whose status is equal to 'X' as whatever data is sent to third party system is marked as 'X' in status field of table after sending.
    You need to first fetch the data into internal table using the select statement where status EQ space. You get the data which is not yet transmitted to third part. And later in the program after trasmitting the data to third party modify the Records in the DB table which are transmitted with Staus eq 'X'.

  • How to fetch records from query.....

    hii experts,
    How to fetch data from following query.... The query is depend on the Project_Id
    SELECT           'Plant Consumption' TYP,                                 -1*ROUND(SUM (MTA.BASE_TRANSACTION_VALUE)) S_VALUE,
    TO_CHAR (MMT.TRANSACTION_DATE, 'Mon-rrrr') MNTYR,
    TO_CHAR (MMT.TRANSACTION_DATE, 'rrrrmm') MNT,
                        TO_CHAR(MMT.TRANSACTION_REFERENCE) TRX_REF,
                        MMT.SOURCE_LINE_ID SRC_LIN,
                        TO_CHAR(MMT.SHIPMENT_NUMBER) SHP
    FROM (SELECT TO_CHAR( OLA.HEADER_ID) HDR1,
                        OLA.LINE_ID LINE1,
                                  OLA.PROJECT_ID ,
                                  TO_CHAR(OLA.SHIPMENT_NUMBER) SHP1
                             FROM OE_ORDER_HEADERS_ALL OHA,
                                  OE_ORDER_LINES_ALL OLA
                             WHERE OHA.HEADER_ID = OLA.HEADER_ID
                             AND OHA.ORG_ID = OLA.ORG_ID
                             AND OLA.PROJECT_ID = :P_PROJECT_ID
                             AND OLA.ORG_ID = :P_ORG_ID
                             AND OLA.FLOW_STATUS_CODE = 'CLOSED'
                             ) A,
                        MTL_MATERIAL_TRANSACTIONS MMT,
    MTL_TRANSACTION_ACCOUNTS MTA,
    GL_CODE_COMBINATIONS GCC
    WHERE MMT.TRANSACTION_ID = MTA.TRANSACTION_ID
    AND GCC.CODE_COMBINATION_ID      = MTA.REFERENCE_ACCOUNT
    AND MMT.TRANSACTION_TYPE_ID = 33
    AND GCC.SEGMENT1 = '11'
    AND GCC.SEGMENT2 = '13'
    AND GCC.SEGMENT3 = '34381'
    AND GCC.SEGMENT4 = '0000'
    AND                GCC.SEGMENT5                     =      '000000'
    AND MMT.SHIPMENT_NUMBER IS NOT NULL
    AND MMT.PROJECT_ID IS NULL
    AND           A.HDR1           = TO_CHAR(MMT.TRANSACTION_REFERENCE)
    AND                A.LINE1           = MMT.SOURCE_LINE_ID
    AND A.PROJECT_ID = :P_PROJECT_ID
    AND                A.SHP1           = TO_CHAR(MMT.SHIPMENT_NUMBER)
    GROUP BY TO_CHAR (MMT.TRANSACTION_DATE, 'rrrrmm'),
         TO_CHAR (MMT.TRANSACTION_DATE, 'Mon-rrrr'),MMT.TRANSACTION_REFERENCE,MMT.SOURCE_LINE_ID,MMT.SHIPMENT_NUMBER;
    -----

    hii
    The project_number is matching column in table mtl_material_transaction mmt and A (FROM CLAUSE query). But data retreive based on
    WHERE MMT.PROJECT_ID IS NULL
    AND A.PROJECT_ID = :P_PROJECT_ID
    PS

  • How to track which segments are growing day by day????

    I have my Index tablespace which is getiing full day by day.
    I am doing analysis every day.
    Right now 4700MB is free.
    I am checking every day by how increase is there.
    some day its 40MB and some day its 112Mb.
    Right now its 91% full and 9% free.
    My analysis is that My tablespace will get full in around next 30 days.
    I have searched for segemnts in that tablespace and found that all are indexes and some of the tables are also placed in this tablespace....
    My question is:
    every day that tablespace increase by 100Mb . Is ther way to find which particular segment in that tablespace is growing day by day ,My belief is one of the tables that is mistakely palced in index tablespace.
    How can I achieve what I want??
    Thanks

    You could record the size of the segments of the given tablespace every day: create table t as select * from dba_segments where tablespace_name = &tsname
    ; And then on the day after that you would query something like: select s.segment_name,
              s.bytes-t.bytes segment_growth
       from dba_segments s, t
    where s.tablespace_name = &tsname
        and s.tablespace_name = t.tablespace_name
        and s.segment_name = t.segment_name
    ;  And then truncate table t and populate it with current data and repeat next day.
    edit: dba_objects => dba_segments
    Message was edited by:
    antti.koskinen

  • How to Fetch a data from HR Master Tables?

    HI,
    For all employees who have Infotype 0194 records valid in the time period or payroll period selected who have the vendor selected on the selection screen, you have to read the payroll results and find the Garnishment document in the GRORD if it exists. If a time period is selected, you must search for all payroll results with a check date that falls in that time period. If a payroll period is selected, search for that particular payroll and any off-cycle payroll whose check date falls between the begin date and end date of that pay period.
    Once you searched IT 0194 for Employees (EE) with the Garnishment Vendor selected and then found the payroll results to process, you must search through payroll internal GRDOC and find the same vendor. If the vendor is found, search the payroll Results Table (RT) for the V0 split which matches the GRDOC record. Then use this amount(s) for the Deduction Amount field.
    I have to fetch the Deduction amount according to the given Scenario,and I have to create an Outbound Interface Program to which creates an TXt file in Client Application server with Required fields
    Case Number:
    P0194-GCASE
    Social Security Number:
    P0002-PERID
    Employee First Name:
    P0002-VORNA
    Employee Last Name:
    P0002-NACHN
    Deduction Amount:
    Payroll Results RT
    Can any one pls know me the entire procedure how to fetch the deduction amt based on the given scenario and what r the select statements i have to write to fetch required fields listed above.

    to provide infotype data you should use logical database PNP (see docu there)
    that will create a selection screen by default.
    In your report you have to specify
    TABLES: PERNR.
    INFOTYPES: 0002, 0194, ....
    start-of-selection.
      get pernr.
      here you get all the specified infotypes in tables pxxxx
    end-of-selection. " ends processing one pernr and starts with next GET PERNR
    there is a function module to read payroll results
    PYXX_READ_PAYROLL_RESULT
    in your report you have to initialize the buffers first
    HR_PCLX_INIT_BUFFER
    and then get the cluster directory (RGDIR)
    CU_READ_RGDIR

  • How to fetch bank fields in fbl1n

    plz tell me the process how to fetch bank details of particular vendor in fbl1n.
    Moderator message: welcome to SCN, always search for available information before posting, show what you have done yourself when posting.
    Edited by: Thomas Zloch on Jan 19, 2012

    how to fetch two different field records of two different tables in a single row?
    i need to display in a single column
    I'm going to assume that you mean the second one.
    without using union query?
    Can't as far as I know.
    if i use union query i have to give equal both right and left columns
    I don't actually know what you mean by this and I'm not going to guess.
    I reckon Sarma's answer (although it does use union even tho you specified that you don't want to use it) is what you need. If it is NOT what you need, please reply with the specifics of your requirement. i.e. post create table statments and insert statements that will build a valid test case. Also post what results you expect along with what you have tried (the code not a description)

  • How do I create a DNS record on my Mac Server?

    How do I create a DNS record on my Mac Server?

    The following is info that I found in another post that I have been trying to follow.
    MrHoffman      New England
    Re: Configure DNS - OS X Server Next Steps
    Feb 13, 2011 6:36 AM (in response to Jimbooooooo)
    You're setting up internal DNS services, you referenced your ISP DNS servers and you should not have, and now those servers have no translations for your hosts. This is a common misconfiguration.
    See [configuring DNS on Mac OS X Server|http://labs.hoffmanlabs.com/node/1436] for how to set up your internal DNS server.
    And if there are any references to your ISP DNS servers here (within your client settings, within your server settings, your Airport settings, etc), then you're usually going to have DNS and connectivity problems. You're running a server now, so you'll be running your own services, and (particularly because of NAT here) referencing only your own DNS server(s).
    You may be setting up external DNS (if and when you need that), but that should happen after you set up your internal DNS. The above article has a link to setting up external DNS, when you get around to that, if/when you need in-bound connections into your LAN.

  • How to find out top 10 records from the R/3 using Java code (WD Program)

    Hi Experts,
    I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.
              wdContext.nodeGraphData().invalidate();
              IPublicCostcnt.IGraphDataElement categoryElement;
                   for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
                   categoryElement = wdContext.createGraphDataElement();
                   categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
                   categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
                   categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
                   wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

    Dear SDN Users,
    This is how I resolved the issue.
    1) Requested ABAPer to provide me sorted data. The data has been sorted in descending order of actual_cost.
    2) After that I used following code. This resolved the issue.
         if (wdContext.nodeItab_Final1().size()>10){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < 10; i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
         if (wdContext.nodeItab_Final1().size()<=10){
         if (wdContext.nodeItab_Final1().size()>0){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

  • How to Maintain the Pricing Condition Records in CRM

    Hi
    I am new to the CRM
    How to maintain the pricing condition records in crm for the particular condition type?
    as we do in SD(VK11)
    Thanks

    Hi Binu,
    First of all, you could maintain pricing conditions in the following places:
    1. In General Condition Maintenance (GCM)
    2. At the product maintenance level
    3. At the 'Price agreement' tab of Contracts
    4. As manual conditions during order processing at item level
    Now, if you want to maintain conditions using GCM, you first have to maintain a condition maintenance group in the customizing where in you can assign condition table and condition type for different counter values. I am assuming that you have done this activity successfully.
    When you run the transaction '/SAPCND/GCM', for application 'CRM', your condition maintenance group name and context 'GCM', you will be initially taken to a screen where in you'll have an item area which would be blank and then condition fields would be displayed in a tree on the left.
    Here, select the field 'Condition type' and click on icon 'Select records'. You would get a dialog prompting you to enter condition type. Here you can specifiy the condition type for which you want to maintain/view condition records.
    If no condition records are available, item area would be left blank. Here, you can choose a condition type using the standard F4 help. Depending on condition types that are assigned to condition maintenance group, different condition types would be displayed in the F4-help using which you can maintain condition records.
    Hope this helps.
    Regards,
    Pavithra
    **PS: Please reward points if this helps.

  • Fetch more than 1000 records

    Hi,
    I am using APEX_ITEM.SELECT_LIST_FROM_QUERY_XL(). When I try to fetch more than 1000 records in PL/SQL block .It throws character string buffer too small. I donot know how much records it will fetch because it is dynamically generated.
    could you please anyone help me out.

    Hi
    I agree that a popup LOV would be better, for two reasons:
    1 - Even if you could construct a select list with over 1,000 items, users may find it awkward to use as they would have to scroll to find the item they want - at best they could type in the first character of an item but they'd have to scroll from then on or keep pressing the same character to move down one item at a time.
    2 - The fact that you're using that function to generate the list implies that you are using a tabular form and, therefore, that there will be several instances of the list on your page. If so, the time taken to generate the page and download it may slow page load time considerably.
    If you do need to have select lists, there are techniques that you can use to do this - typically, this would involve creating small lists in the form, a hidden select list created as a normal page item and then using javascript to copy the hidden list items into the tabular form fields.
    Andy

  • How to fetch geometry of values

    How to fetch geometry of values,
    I wanted to fetch the 4th positioned n 5th positioned values from the
    SDO_ORDINATE_ARRAY and one unique Column ID,
    sample data for the same follows
    SQL> desc TEST
    Name Null? Type
    GEOMETRY MDSYS.SDO_GEOMETRY
    ID NUMBER
    SQL> select id, geometry from test
    where rownum<7
    TEST GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    1 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408551.27, 2925997.25))
    2 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(.011493516, -.99993395, 0, 408442.69, 2925997.45))
    3 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(-.02636329, .999652428, 0, 408551.45, 2926096.46))
    4 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408551.77, 2926212.98))
    5 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408552.01, 2926314.81))
    6 SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, 0, 0, 408470.67, 2926137.08))
    6 rows selected.
    SQL>
    another table TESTZ is created to insert the fetched values from TEST
    table
    SQL> desc TESTZ
    Name Null? Type
    TEST NUMBER
    ES NUMBER
    NR NUMBER
    The following pl/sql program is used for fetching the required data
    DECLARE
    CURSOR p_cur
    IS
    select id,geometry from test order by rownum ;
    es number;
    nr number;
    locus mdsys.sdo_geometry;
    BEGIN
    for i in p_cur
    loop
    locus := i.geometry ;
    es:=locus.sdo_ordinates(4);
    nr:=locus.sdo_ordinates(5);
    insert into testz values(i.idz,es,nr);
    end loop;
    END;
    ERROR at line 1:
    ORA-06533: Subscript beyond count
    ORA-06512: at line 20
    the same Script is working well for other data sets But its giving the
    following Errror for the ABOVE
    data set, the test table got 90,000 records
    please Suggest me the required Solution to fecth the 4th and 5th
    postioned values from SDO_ORDINATE_ARRAY ;
    Many thanks
    ZameeR

    As I said in another posting (this is a cross-post):
    drop table test;
    create table test (id integer, geometry mdsys.sdo_geometry);
    insert into test ( id, geometry ) values (
    1,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408551.27, 2925997.25)));
    insert into test ( id, geometry ) values (
    2,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(.011493516, -.99993395, 0, 408442.69, 2925997.45)));
    insert into test ( id, geometry ) values (
    3,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(-.02636329, .999652428, 0, 408551.45, 2926096.46)));
    insert into test ( id, geometry ) values (
    4,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408551.77, 2926212.98)));
    insert into test ( id, geometry ) values (
    5,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(0, 1, 0, 408552.01, 2926314.81)));
    insert into test ( id, geometry ) values (
    6,SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, 0, 0, 408470.67, 2926137.08)));
    commit;
    select a0.id, c.column_value, e.column_value
    from test a0,
          (select b1.id, mod(rownum,5) rown, b2.*
             from test b1,
                  table(b1.geometry.sdo_ordinates) b2
          ) c,
          (select d1.id, mod(rownum,5) rown, d2.*
             from test d1,
                  table(d1.geometry.sdo_ordinates) d2
          ) e
    where ( c.id = a0.id and c.rown = 4 )
      and ( e.id = a0.id and e.rown = 0 )
    /Requires no external functions or packages.
    regards
    Simon

Maybe you are looking for