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

Similar Messages

  • 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 find if certain record exists from stored procedure

    Hello
    I am not an expert in this and am trying simple thing. I want to find if certain record exists in a table and if so set some boolean variable.
    create or replace procedure findit(param)
    AS
    return_group boolean;
    BEGIN
      myflag := false;
    --here goes my question
    -- say I have SELECT WHATEVER FROM TABLE WHERE BLA = param
    --if it returns at least one record set myflag to true;
    END;Any idea?

    THanks Satyaki_De,
    However, when I put simple SELECT statement in the body of my procedure it does not compile. Actually I should have said that before. So here is my code and where it breaks:
    create or replace procedure close_subjects(study_id varchar2)
    AS
    return_group boolean;
    BEGIN
    dbms_output.enable(1000000);
    FOR current_group IN(
       SELECT DISTINCT group_id from groups WHERE study_id=study_id
    ) LOOP
       FOR current_subject IN(
          SELECT individual_id from groups WHERE group_id=current_group.group_id AND study_id=study_id
       ) LOOP
          return_group := true;
          SELECT INDIVIDUAL_ID FROM ASSIGN WHERE DATE_TIME_ASSIGNED = ( SELECT MAX(DATE_TIME_ASSIGNED) FROM ASSIGN WHERE INDIVIDUAL_ID = current_subject.individual_id ) AND                            ASSIGN_STATUS_ID = 'A';
         IF SQL%RowCount = 0 THEN
           return_group := false;
             dbms_output.put_line(current_subject.individual_id);
          END IF;
       END LOOP;
    END LOOP;
    END;
    /If I comment out SELECT statement and leave dbms_output for testing purposes it works well. As I said I am faaaar from expert and seems to me that I cannot have SELECT in procedure BODY?

  • How to fetch the distict records from xcelsius excel column

    i have brought the datas from database using webservice
    from this data i want to fetch the distinct records in another column
    how to do this without using third party tool like "Centigon filtered summary"
    plz help me.
    Regards
    Ram.G
    Edited by: g.ram84 on Dec 1, 2009 6:57 AM

    Hi Ram,
    This can be achieved using functionalities within excel of the Xcelsius.
    Please try the steps below:
    1) From the excel menu choose Data | Filter | advaced Filter.
    2) choose your entire range.
    3) choose location to copy.
    4) choose Unique records only
    and only unique records will be copied.
    Hope this helps...
    Regards,
    Ankeet

  • How to fetch all the records

    Hello everybody,
    I am currently working on SQL Developer for the couple of weeks. I have specific need to check, how much time one query take to fetch all the records. Currently it can fetch only 50 records and when scroll then next 50 records and so on.
    Can anybody tell me, how to set this to fetch full records
    Regards,
    Martand M Joshi

    Martand,
    There's no setting to fetch all records. You wouldn't like SQL Developer to fetch for minutes on big tables anyway.
    If, for 1 specific table, you want to fetch all records, you can do Control-End in the results pane to go to the last record. You could time the fetching time yourself, but that will vary on the network speed and congestion, the program (SQL*Plus will be quicker than SQL Dev because it's more simple), etc.
    Now, what I think you really want here, is getting the execution time. If you really want to analyze the query's performance, you'd have to use the explain plan, autotrace and tkprof (see the manual for tuning and performance).
    To make us life easier, the makers of SQL Developer included support of the explain plan, and as of v1.1, autotrace!
    I'm sure you've got enough to work things out from here...
    Regards,
    K.

  • How to update all condition records at a time with some percentage or some

    Dear Sir,
    In PRD system we have more than 600 condtion records.
    Noe desiel hikes happend, due to that client want to update all condition records(600) at a time with required percentage or required value.
    How to update all records at a time
    With regards
    Lakshmikanth

    Hi,
    Through BDC or LSMW first you have to do the recording for particular transaction code and then base on that u have to prepare the flat file to upload the file for the same.
    For BDC programing you have to take the help of ABAP progmer but LSMW you can also do.
    For more information about LSMW plz go to following link :
    [LSMW |http://www.slideshare.net/arun_bala1/sap-sd-lsmw-legacy-system-migration-workbench/]
    [Step-by-Step Guide for using LSMW|www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc ]
    BDC
    [BDC Call Transaction|http://www.sapdevelopment.co.uk/bdc/bdc_ctcode.htm]
    [BDC Recording|http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm]
    But it would be better for you to please contact to your ABAPer for BDC programming.
    Cheers...

  • How to delete some of records from wf_notifications table any API Name?

    Hi All,
    I want to delete some of records from wf_notifications table , can any one tell API' name and Back end delete process.
    Thanks,
    Ramu
    Edited by: Ramu on Mar 20, 2013 5:42 AM

    Hi ,
    I hv done below script, now it's working fine.
    DECLARE
    CURSOR csr_transaction_id IS
    SELECT   hat.transaction_id,
             hat.item_type,
             hat.item_key,
             ppx.employee_number,
             hat.section_display_name
      FROM   hr_api_transactions hat, per_people_x ppx
    WHERE   hat.process_name = 'HR_PERSONAL_INFO_JSP_PRC'
             AND hat.selected_person_id = ppx.person_id
             AND ppx.employee_number IN
                      ('100024773',
                       '100024820',
                       '100024859',
                       '100024879',
                       '100024902',
                       '100024937',
                       '100025137',
                       '100026470',
                       '610014755',
                       '610017039')
    order by  ppx.employee_number;
    BEGIN
      dbms_output.put_line('***Deleted all Transactions  and Notifications of below Employee Personals Tranactions ***');
       FOR my_cur_v IN csr_transaction_id
       LOOP
       /*Delete all Transaction_id's in hr_api_transactions,hr_api_transaction_steps,hr_api_transaction_values and hr_api_transaction_steps_bk tables */
        hr_transaction_swi.delete_transaction
                              p_transaction_id =>my_cur_v.transaction_id,
                              p_validate => hr_api.g_false_num
        wf_engine.abortprocess  (
                                  itemtype => my_cur_v.item_type,
                                 itemkey => my_cur_v.item_key
         /* Deleted all Notification_id's and item_key's in wf_item_activity_statuses,wf_items,wf_item_attribute_values,wf_notifications     Table */                     
         wf_purge.items (
                          itemtype => my_cur_v.item_type,
                         itemkey => my_cur_v.item_key
        dbms_output.put_line('Emp No --'||my_cur_v.employee_number||'Transaction_id :'||my_cur_v.transaction_id||'Emp Personal Info :'||my_cur_v.section_display_name||
                              'Item Type :'||my_cur_v.item_type|| 'Item Key :'||my_cur_v.item_key); 
       END LOOP;
       commit;
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line('hr_transaction_swi.delete_transaction api goest to exception block'    ||sqlcode|| '  '||sqlerrm);
    END;  
    /thanks,
    Ramu

  • How to select only one record at a time in ALV

    Hi all,
    I have to use ALV report.  Each record on the report output should have a button (or radio button) which will allow the record to be selected.  My requirement is to select only one record at a time.
    please guide me how to proceed further.
    regards
    manish

    hi
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/sampleCheckBoxProgram
    Regards
    Pavan

  • How can one display 1 record at a time

    How can one display a single record at a time.
    The next record should be displayed on the press of a button.
    Thanks in advance

    Vijaya,
    I have 3 regions, each contains a check box item,
    the label for which is dynamicaly generated through a SQL Select.
    ( &P1_ANSWER1. P1_ANSWER1 is the hidden item name)
    In the Region Source,
    I have put
    SELECT col1 from (SELECT col1, row_number() over(ORDER BY col1) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    SELECT col3 from (SELECT col3, row_number() over(ORDER BY col3) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    for each of the reqion that contains these items,
    Here the table is prototype and P1_QUESTION_NO is the hidden item.
    As directed I have included under Processes (after submit and computations) on button "Next Record" clicked:
    :P1_QUESTION_NO := ::P1_QUESTION_NO + 1;
    When I am doing this, the label seems to blank out.
    Thanks
    Message was edited by:
    faq123

  • How to fetch the required record into the cache

    Dear sirs...
    An application written in Jdeveloper 10g 10.1.2.1 that uses ADF. It is requred to process some records. When i get the view object & try to go to the first record i get the following error:
    05/11/30 23:13:26 Error Message:JBO-25046: Requested row not available in row set iterator FilesView1.
    oracle.jbo.RowNotAvailableException: JBO-25046: Requested row not available in row set iterator FilesView1.
         at oracle.jbo.client.remote.RowSetIteratorImpl.first(RowSetIteratorImpl.java:851)
         at oracle.jbo.client.remote.RowSetImpl.first(RowSetImpl.java)
         at oracle.jbo.client.remote.ViewUsageImpl.first(ViewUsageImpl.java)
         at oracle.jbo.common.ws.WSRowSetIteratorBase.first(WSRowSetIteratorBase.java:328)
         at view.ViewmailAction.onDelete(ViewmailAction.java:80)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at oracle.adf.controller.lifecycle.PageLifecycle.handleEvent(PageLifecycle.java:544)
         at oracle.adf.controller.struts.actions.StrutsPageLifecycle.handleEvent(StrutsPageLifecycle.java:252)
         at oracle.adf.controller.struts.actions.StrutsUixLifecycle.handleEvent(StrutsUixLifecycle.java:249)
         at oracle.adf.controller.lifecycle.PageLifecycle.processComponentEvents(PageLifecycle.java:477)
         at oracle.adf.controller.struts.actions.StrutsUixLifecycle.processComponentEvents(StrutsUixLifecycle.java:162)
         at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:236)
         at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:430)
         at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:126)
         at oracle.adf.controller.struts.actions.StrutsUixLifecycle.handleLifecycle(StrutsUixLifecycle.java:70)
         at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:223)
         at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:155)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:509)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    How can I fetch the first row into the cache?
    I checked the documentation & it says i should call the required API to put the record into the cache & then retry the operation, so what is this API? what should i do?
    Thanks alot for any help
    best regards

    I'd recommend processing the records inside a custom method on your application module. This is a best practice whever you can do it, and it makes your application easier to maintain and test.
    I'd also recommend using Immediate Mode instead of Batch Mode. Please see this article on the subject:
    http://www.oracle.com/technology/products/jdev/tips/muench/batchmode/index.html

  • How to fetch the data records in summary format based on previous day

    drop table T1;
    create table T1(Class, Fees_Collected, Submit_Date) as select
    'MBA', 100000, '7/30/2012' from dual union all select
    'Btech', 20000, '7/10/2012' from DUAL union all select
    'MBA', 45000, '8/1/2012' from dual union all select
    'Btech', 55550, '7/31/2012' from DUAL union all select
    'BBA', 250660, '7/30/2012' from dual union all select
    'MBBS', 44556000, '7/31/2012' from DUAL union all select
    'BDS', 420050, '8/1/2012' from DUAL union all select
    'BBA', 30450, '7/30/2012' from DUAL union all select
    'MBBS', 120450, '7/31/2012' from DUAL union all select
    'BDS', 45950, '7/30/2012' from DUAL union all select
    'MBA', 252450, '8/1/2012' from DUAL;My requirment is to fetch the records based on summary format to display the data with following columns -
    Class |Prev Day Traded Value |Prev Day % of Total |Prev Day % MBA
    Note - Previous Day definiton (Buisness Day) = calendar days - (weekends + US Holidays)
    Kindly help me, as i want to keep it customized so that without specifying the hard coded dates ( Previous Day) it runs through and provide me the resultset....
    All of your help and time is highly appericated.

    You mean business days I guess ?
    I use a function (I had to write it myself) <tt><b> next_business_day(p_start_date in date,p_days_count in number) return date </b></tt>
    where I loop forward/backward from p_start_date according to the sign of p_days_count the required number of steps skipping weekends and holidays as the absolute value of p_days_count is mostly under 30 for the rest (at least around here) Oracle's <tt><b> add_months </b></tt> gets it done.
    Regards
    Etbin
    Edited by: Etbin on 6.8.2012 17:55
    Year till date: <tt><b> your_date between trunc(sysdate,'year') and sysdate </b></tt> is it ? http://en.wikipedia.org/wiki/Year-to-date ?
    Edited by: Etbin on 6.8.2012 18:27
    NOT TESTED!
    function next_business_date(p_start_date in date,p_count_days in number) return date is
      steps  number := abs(p_count_days);
      retval date := p_start_date;
    begin
      if p_start_date is null or p_count_days is null then
        return to_date(null);
      end if;
      while steps > 0
      loop
    /* skipping weekends and (yet to be implemented) holidays */
        while to_char(retval,'dy') in ('sat','sun') /* or is_holiday(retval) */
        loop
          retval = retval + sign(p_count_days);
        end loop;
    /* retval contains a business day now */
        retval = retval + sign(p_count_days);
        step := step - 1;
      end_loop
      return retval;
    end;

  • How to fetch first 4 records from database.

    hi experts.i am inexperience in this field.
    please tell me suppose i want to extract only 4 records from the database ,
    what is the select statement for this .
    best regards.
    subhasis.

    Hi
    use this program as example.
    u wil get solution.
    REPORT  ZSEN_ABAP_TABLE                         .
    Tables : mara.
    data : wa_mara type mara,
           it_mara type table of mara.
    SELECT * UP TO 4 ROWS FROM MARA INTO TABLE it_mara.
    loop at it_mara into wa_mara.
    Write : / wa_mara-MATNR,
             wa_mara-MTART,
             wa_mara-BISMT.
    endloop.
    Thanks
    Senthil

  • How can i update multiple records at same time in psa

    Hi,
    i need to modify certain column's value in psa. for one of InfoObject  fix value i need to change to some other value, can i write some routine or any other way to do so quickly.
    thnx

    If you are in prod, its tough to write code to manipulate PSAs. First of all, you need to transport your Program. Also, if you make a mistake, you can potentially change other PSAs.
    If you insist, get the name of the PSA. Go to RSA1, PSA tab. THere, right click on your infosource and select Delete PSA. DON'T DELETE anything in this screen. Just copy the Table name (look around, you will find it there). Now, go to SE16 and lok at the table contennts. If you give Req, data pack, etc, you can access multiple records. Now, write the program "carefully"  to access and change records in this table.
    There is another way, but this will work-out for you.
    Uday-Ram Chamarthy

  • How many shows can you record at one time?

    I have the CHS435HDC and I was talking to the rep and he thought it was 7 shows at one time....being a previous tech rep from the 'other guy', I know the standard is two shows at once and watching one of the other, nothing beyond those two.....
    Anyone know the answer?  Checked the website and didn't get anything, googled the manual and that was no help and cicso website doesn't show this model...
    Thanks in advance...
    K

    humarock1150 wrote:
    I have the CHS435HDC and I was talking to the rep and he thought it was 7 shows at one time....being a previous tech rep from the 'other guy', I know the standard is two shows at once and watching one of the other, nothing beyond those two.....
    Anyone know the answer?  Checked the website and didn't get anything, googled the manual and that was no help and cicso website doesn't show this model...
    Thanks in advance...
    K
    You can record two programs at once, and concurrently:
    1) Watch either of the programs being recorded.
    2) Watch a previously recorded program.
    You cannot watch a third channel or a VOD program.
    The above is on the DVR itself. If you have additional STBs, you can of course watch other channels or VOD on them.
    Justin
    FiOS TV, 25/25 Internet, and Digital Voice user
    QIP7232, QIP7100-P2, IMG 1.9.1
    Keller, TX 76248

  • How to fetch Functional Area for FTE (Full Time Equivalent)

    Hi
    We have a report that needs to be developed--FTEs for each Functional Area.
    We are trying to fetch Functional Area from Employee's Master Cost Center. Our structure has Employee; Master Cost Center, Functional Area and FTE. However this structure is not showing any values. What is the way out. We are on BI-7.0 and we are using standard BI Objects [0Employee; 0Cost Center].
    Appreciate your suggestion.
    Regards
    Srinivas

    Hi
    I wish to provide more information to you.
    We are implementing Integrated Planning (BI 7.0).
    Even though Functional Area is a Navigational Attribute of Cost Center when I am trying to establish Characteristic Relationship between Cost Center and Functional Area. I am not seeing Functional Area for the Cost Center.
    I believe if we could establish the relationship we can fetch the relevant report from the layout.
    Regards
    Srinivas

Maybe you are looking for

  • Can't open contacts app on my macbook

    Can't open contacts app on my Macbook. I thought upgrading to Yosemite would fix the problem, it did not. The error message I get when trying to open Contacts: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:

  • Identify the user of the scheduled report

    Hi we are using Oracle Discoverer (9.0.4) . i have a question on this . we have identified a scheduled report which was still running for the last 2 days . i want to track the report name and the owner of the report . is there a way to identify this

  • Difficulty placing an image in targeted spot

    Hi, I've just inserted the bottom image onto my homepage (creative corner) on this test page to get the placement correct. As you can see, it is not flush with the left hand side, therefore is is breaking the table and pushing the two columns apart.

  • RAM upgrade in Macbook Pro 13" 2014

    Hello Everyone, Please let me know if I buy 13-inch MacBook Pro with Retina display with 8 GB of RAM, will I be able to upgrade it to 16 GB later. I mean is it solded to motherboard or fits into a PCI slot. Regards, Vikas

  • Questions on JDI

    Hi All, I have some questions about JDI. Could anybody help to answer them? 1. Some components need to use API provided by some jar files. These JAR files are provided by third party. How could we check in those jar files to DTR? 2. There're some EJB