Select query for every 1000 records

Hi all ,
         Please help me in the issue . I am using select query Select * from table up to 1000 rows for acheving the records but i want this process to retrigger once the process of 1000 records is compleded again it needs to fetch the next 1000 records and process the same . I am changing the status of the processed records once it is processed . Can can one tell me how to retrigger the select query once the 1000 records are processes.
Thanks in advance,

Hi Eric,
              After selecting the 1000 records, find the key value of the last record. Build up the range as GT. Again use the select query.
For example,
Select * into table lt_data from ztab
where key in r_key
up to 1000 rows.
regards,
Niyaz

Similar Messages

  • Commit for every 1000 records in  Insert into select statment

    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
       from emp e , dept d
      where e.deptno = d.deptno       ------ how to use commit for every 1000 records .Thanks

    Smile wrote:
    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.Does the another table already have records or its empty?
    If its empty then you can drop it and create it as
    create your_another_table
    as
    <your select statement that return 60000000 records>
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .That is not the best way. Frequent commit may lead to ORA-1555 error
    [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:275215756923]A nice artical from ASKTOM on this one
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
    from emp e , dept d
    where e.deptno = d.deptno       ------ how to use commit for every 1000 records .
    It depends on the reason behind you wanting to split your transaction into small chunks. Most of the time there is no good reason for that.
    If you are tying to imporve performance by doing so then you are wrong it will only degrade the performance.
    To improve the performance you can use APPEND hint in insert, you can try PARALLEL DML and If you are in 11g and above you can use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_parallel_ex.htm#CHDIJACH]DBMS_PARALLEL_EXECUTE to break your insert into chunks and run it in parallel.
    So if you can tell the actual objective we could offer some help.

  • Message split for every 1000 records

    Hi All,
    My scenario is Proxy to File.We have to process thousands of records from r/3 to.I need to create separate XML file for every 1000 records in receiver directory.Is there any solution to achieve this?
    Thanks in advance
    Kartikeya

    here;s the blog krish was referring to..
    Night Mare-Processing huge files in SAP XI

  • Trigger for every 1000 record insert

    Hi
    I am working in oracle 9i / Aix 5.3
    I need a trigger which should fire whenever my temp_table growing 1000,2000...etc.,
    The records should reach me in the body of email.
    Like
    Hi
    The temp_table count has been reached to 1000.
    Thanks
    second time execution...
    Hi
    The temp_table count has been reached to 2000.
    Thanks
    etc.,
    How can i achieve this? I'm ok to shell script also for the above functionality
    Thanks
    Raj

    Why do you want to do this?
    SQL> create table temp_table (x number);
    Table created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function temp_table_cnt return number is
      2    pragma autonomous_transaction;
      3    v_cnt number;
      4  begin
      5    select count(*) into v_cnt from temp_table;
      6    return v_cnt;
      7* end;
    SQL> /
    Function created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace trigger trg_a_temp_table
      2  after insert on temp_table
      3  for each row
      4  declare
      5    v_cnt number;
      6  begin
      7    v_cnt := temp_table_cnt();
      8    if mod(v_cnt,1000) = 0 then
      9      dbms_output.put_line('Email Sent for '||v_cnt||' records.');
    10    end if;
    11* end;
    SQL> /
    Trigger created.
    SQL> set serverout on
    SQL> ed
    Wrote file afiedt.buf
      1  begin
      2    for i in 1..3456
      3    loop
      4      insert into temp_table values (i);
      5      commit;
      6    end loop;
      7* end;
    SQL> /
    Email Sent for 0 records.
    Email Sent for 1000 records.
    Email Sent for 2000 records.
    Email Sent for 3000 records.
    PL/SQL procedure successfully completed.
    SQL>... however I wouldn't consider this good design, as it requires each of the rows to be committed so that the autonomous transaction procedure can count the number of rows on the table. Of course, if the rows are being inserted through, let's say, user input and are committed on a 1 by 1 basis anyway, then it's perfectly acceptable, but I wouldn't use it for bulk insertions.

  • Query results:every other record/row grey and white

    Hello guys,
    query results:every other record/row grey and white
    how would you make every other record/rows a different color
    just like the forums color. Lightest grey and white?
    <cfquery name="Myqueryname"
    datasource="#Request.MainDSN#">
    SELECT
    CompanyID,
    CompanyName,
    Address,
    City,
    State,
    ZipCode,
    Comments
    FROM
    Company
    ORDER BY
    CompanyName ASC
    </cfquery>
    <html>
    <head>
    <title>CF TUTORIALS</title>
    <link rel="stylesheet" href="styles.css">
    </head>
    <body>
    <h1>All CO Listings</h1>
    <table>
    <tr>
    <td><b>ID</b></td>
    <td><b>Name</b></td>
    <td><b>Address</b></td>
    <td><b>City</b></td>
    <td><b>State</b></td>
    <td><b>ZIP Code</b></td>
    <td> </td>
    </tr>
    <cfoutput query="Myqueryname">
    <tr>
    <td>#CompanyID#</td>
    <td>#CompanyName#</td>
    <td>#Address#</td>
    <td>#City#</td>
    <td>#State#</td>
    <td>#ZipCode#</td>
    <td>
    <a href=" ALL Emps.cfm?CompanyID=#CompanyID#">ALL
    Emps</a>
    <a href=" AddCO Form.cfm">AddCO</a>
    <a href="
    Editco.cfm?CompanyID=#CompanyID#">Editco</a>
    <a
    href="CoDeleteForm.cfm?CompanyID=#CompanyID#">Delete</a>
    </td>
    </tr>
    </cfoutput>
    </table>
    </body>
    </html>

    There is a cool tool in Coldfusion called MOD
    This basically calculates the remainder of the row number
    when divided.
    I interpreted its use to something like this, which has
    worked for me.
    <cfoutput query="qry_requestedlist" maxrows="30"
    startrow="1">
    <cfset EvenRow=#CurrentRow# +1>
    <cfif CurrentRow Mod 2 IS 1>
    <tr>
    <th class="grey" CurrentRow#</th>
    <cfelse>
    <th class="white">#CurrentRow#</th>
    <tr>
    </cfif>
    </cfoutput>
    I doubt this is precisely what you want but this is the sort
    of thing.

  • Can any one send select query for this?

    Hi,
    can any one plese send select query for the following query.please send as early as possible.
    Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
    I_OUTPUT-BUKRS     Company code     I_BSID-BUKRS
    I_OUTPUT-KUNNR     Customer number     I_BSID-KUNNR
    I_OUTPUT-NAME1     Customer Name     I_KNA1-NAME1
    I_OUTPUT-KNKLI     Credit account     I_KNKK-KNKLI
    I_OUTPUT-KDGRP     Customer Group     I_KNKK-KDGRP
    I_OUTPUT-KLIMK     Credit Limit     I_KNKK_KNKLI-KLIMK
    I_OUTPUT-KVGR1     Business Unit     I_KNVV-KVGR1
    I_OUTPUT-REBZG     Invoice Number     I_BSID-REBZG
    I_OUTPUT-BLDAT     Invoice Date     I_BSID-BLDAT
    I_OUTPUT-WAERS     Document Currency     I_BSID-WAERS
    I_OUTPUT-DUE_DATE     Due Date     Based on below
    Calculation
      Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above.    Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
                       If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
    Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days)                                                          For  Credits  Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.)  Based on the due date.
    Thanks&Regards,
    praveen kumar.A

    HI,
    To get Open Items you can use Function module:
    data:i_items TYPE STANDARD TABLE OF rfpos.
    CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
    EXPORTING
    bukrs = p_bukrs
    kunnr = wa_customer-kunnr
    TABLES
    t_postab = i_items
    EXCEPTIONS
    no_open_items = 1
    OTHERS = 2.
    Table I_items will have all the open items for that Customer in the given company code.
    Well for Clear Items: Try
    GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
    Hope it helps.
    Manish

  • Creating 1 spool for every 1000 sapscripts

    Hi Friends ,
    I have a program where i am printing W-2 forms (sapscripts) . There are a total of 3000 forms . I need to be able to split them into 3 spools of 1000 each instead of creating 3000 spools . Please advise as to wat parameters need to be set in the beginning and when starting a new set of spool with 1000 forms .
    Thanks,
    Teresa

    You need to count the records and then for every 1000 you have to make a new SPOOL..
    LIke:
    LOOP AT ITAB.
    CNT = CNT + 1.
    ITCPO-TDNEWID = ' '.
    IF CNT =  1.
      ITCPO-TDNEWID = 'X'.
    ENDIF.
    OPEN_FORM
    wtih OPTIONS = ITCPO.
    WRITE_FORM
    CLOSE_FORM
    IF CNT = 1000.
      CLEAR CNT.
    ENDIF.
    ENDLOOP.
    Regards,
    Naimesh Patel

  • Select Query for smart form-invoice

    Hi Folks,
    I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
    Can anyone here please give me the select query for the same.
    fields to fetched are as follows:-
    1.vbrp-arktx,
    2.vbrp-fkimg,
    3.konv-kbetr with respect to vbrk-knumv
    4.konv-kwert.
    And also what all I have to give in format interface and global definitions of the smartform.
    please help  me in this regard.
    Points will be given.
    K.Kiran.

    Hi,
    declare the variables V_arktx(40) and v_Qty like vbrp-fkimp  and other varaibles for Kbetr, kwert, knumv on the global definitions.
    select  single arktx fkimg into (v_arktx, v_qty) from vbrp
    where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
    select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
    this select has to fire in the item level and in the loop.
    so have to write in the correct place.
    select kbetr kwert into (v_kbetr, v_kwert) from konv
    where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
    regards,
    anji

  • How to get wage type for every time record

    Hi Pros,
          I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?

    Hello,
    Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
    Thanks
    Abhishek Shanbhigue

  • How to write selection Query for the following requirment.

    Hi All,
    I am new to ABAP, I need a help ,
    I need to select all plants(WERKS) from MARC at Plant/Material level,
    then I need to take all sales organozation(VKORG) from T001w,
    then I need the company code(BUKRS) from TVKO based on VKORG,
    then I need the currency key(WAERS) from T001 based on BUKRS,
    Can any one help me in writing selection Query for the same?
    Thanks All,
    Debrup.

    Hi,
    Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
    If you struck up anywhere revert back.
    Regards
    Karthik D

  • Select query for fetching from 3 tables.

    Can we have a single Select query for fetching same fields (kappl,kschl,vkorg,vtweg,spart,kunwe,datbi,knuma,datab,knumh)
    from 3 tables >> KOTE707,KOTE708 and KOTE709 into an internal table for a particular KUNNR?
    Regards,
    Shashank.

    Hi,
    If you have kunnr field in all the 3 tables then it is possible. use inner join as below
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
                p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
             fldate TYPE sflight-fldate,
             carrname TYPE scarr-carrname,
             connid   TYPE spfli-connid,
           END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
                   WITH UNIQUE KEY fldate carrname connid.
    SELECT c~carrname p~connid f~fldate
           INTO CORRESPONDING FIELDS OF TABLE itab
           FROM ( ( scarr AS c
             INNER JOIN spfli AS p ON p~carrid   = c~carrid
                                  AND p~cityfrom = p_cityfr
                                  AND p~cityto   = p_cityto )
             INNER JOIN sflight AS f ON f~carrid = p~carrid
                                    AND f~connid = p~connid ).
    LOOP AT itab INTO wa.
      WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    <b>Reward Points if this helps,</b>
    Satish

  • How to add a row for every 5 records using logic:iterate

    Hi,
    In my application, using logic:iterate iam displaying 20 records per page.
    I want to insert a row for every 5 records.
    Please tell how to insert that row.
    Thanks in advance.
    Mohan

    I think this could work for you
    for (int x=1 ; x<=20 ; x++) {
    addRowWithRecord
    if (x%5==0)
    addEmptyRow
    }

  • Create new log file for every 1000 points

    Is it possible to have a new file/folder for every 1000 data points ? 
    How do you check number of points written to a file?

    Need A LOT more context here.  How are you logging the data?  Where is the data coming from?  What format are you saving the data?
    Any code you can supply that would give us context would help us help you.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • Unable to set count for Select Query for BizTalk SQL receive port

    Hi All,
    Iam using BizTalk server 2009 classic SLQ adapter (using XML clause)for my integration to pull records from DB in to my application.
    As per the DB values iam unable to set the record count as this started giving me error below (first it worked for 820 records with select Query.and then 400 and going down with respect to multiple runs).Kindly help .
    Thanks in advance.

    Hi Abhishek,
    iam still getting the same error for 1000 records.
    after turning off PreserveBOM aswell in send pipeline.
    There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "Pipeline " Receive Port:
    "SQLPort" URI: "SQL://XXXXX/OneC_DB/" Reason: An error occurred when parsing the incoming document: "'
    ', hexadecimal value 0x0B, is an invalid character. Line 188, position 3944.". 

Maybe you are looking for

  • Can't view videos in iTunes now

    My computer, previously running on Vista, recently crashed. I backed up my data and loaded Windows 7 instead. Things are running great now, and I have downloaded iTunes 9.2. I have all my music and videos back, but I cannot watch any of the videos on

  • My iMac has slowed to a crawl

    My iMac is running extremely slow (10-15 minutes to open up small simple applications). I ran Disk Utility and when I repaired permissions, I noticed a warning ( Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/M

  • Error while retreiving xml file from database

    Hi- I am trying to configure Planning and getting the following error message at instance configuration step: "Error while retreiving xml file from database" We looked at PlanningSystemDB.properties, changes server name to its ip, reinstalled plannin

  • I now have snow leopard 10.6.3

    I upgraded my os to snow leopard 10.6.3 from a recommendation from here to be able to upgrade my safari. Does any one know how I upgrade my safari now? What I have now os- snow leopard 10.6.3 safari - 4.0.4 (6531.21.100

  • I don't have the source clips on my mac, can I make it work anyway?

    I posted a thread yesterday, but as I put it in the wrong forum and the problem is another, I made a new one. So here is the first post, https://discussions.apple.com/thread/3954346 I have the clips in Imovie, but I can't play them as "the source cli