<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OPEN CURSOR method to fetch data in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199603#M1375894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no it is not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not used to improve performance for simple statements, but for other purposes.&lt;/P&gt;&lt;P&gt;Mainly the WITH HOLD possiblity is interesting if a lot of data should be changed, then after several a database commit can be done, which does not kill the cursor. The processing can continue with the rest of data. Otherwise it could be difficult to figure out what was changed and what not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nested processing is also possible, but I would say not necessary anymore. The join is in recent releases so unproblematic, that hand-made joins are not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Oct 2009 13:33:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-10-16T13:33:17Z</dc:date>
    <item>
      <title>OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199601#M1375892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the following OPEN CURSOR method to fetch data faster than the normal SELECT statement ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR [WITH HOLD] &amp;lt;c&amp;gt; FOR SELECT      &amp;lt;result&amp;gt; &lt;/P&gt;&lt;P&gt;                                  FROM      &amp;lt;source&amp;gt; &lt;/P&gt;&lt;P&gt;                                  [WHERE    &amp;lt;condition&amp;gt;]&lt;/P&gt;&lt;P&gt;                                  [GROUP BY &amp;lt;fields&amp;gt;] &lt;/P&gt;&lt;P&gt;                                  [HAVING   &amp;lt;cond&amp;gt;]&lt;/P&gt;&lt;P&gt;                                  [ORDER BY &amp;lt;fields&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read about this in the following URL, it is not mentioned about its adavantages over normal SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3b23358411d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please let me know if OPEN CURSOR method is faster than normal SELECT and would improve the performance ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Dagny on Oct 16, 2009 1:59 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Dagny on Oct 16, 2009 1:59 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 11:59:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199601#M1375892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-16T11:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199602#M1375893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could easily check this yourself by using ST05 to see if it is faster than a normal SELECT; however, I doubt that you would. Cursors are generally used when the same table must be accessed while another SELECT already has been used against it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 13:05:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199602#M1375893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-16T13:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199603#M1375894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no it is not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not used to improve performance for simple statements, but for other purposes.&lt;/P&gt;&lt;P&gt;Mainly the WITH HOLD possiblity is interesting if a lot of data should be changed, then after several a database commit can be done, which does not kill the cursor. The processing can continue with the rest of data. Otherwise it could be difficult to figure out what was changed and what not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nested processing is also possible, but I would say not necessary anymore. The join is in recent releases so unproblematic, that hand-made joins are not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2009 13:33:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199603#M1375894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-16T13:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199604#M1375895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Siegfried and Rob for the responses. I do not have to make any changes in the database tables. I just need to fetch the data and using this data , fetch data from another database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the SELECT I am planning to write:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT equnr&lt;/P&gt;&lt;P&gt;    FROM equi&lt;/P&gt;&lt;P&gt;  PACKAGE SIZE 10000&lt;/P&gt;&lt;P&gt;  APPENDING TABLE i_equi&lt;/P&gt;&lt;P&gt;   WHERE equnr IN s_equnr&lt;/P&gt;&lt;P&gt;        AND erdat  IN s_erdat.&lt;/P&gt;&lt;P&gt;    DESCRIBE TABLE i_equi[] LINES vn_lines.&lt;/P&gt;&lt;P&gt;    IF vn_lines = cn_lines.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PERFORM export_data_equi TABLES i_equi.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      REFRESH i_equi[].&lt;/P&gt;&lt;P&gt;      CLEAR vn_lines.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I get the data from EQUI, each time 10000 records upto 1500000 records(cn_lines), then using those 1500000 records, in PERFORM export_data_equi, I am getting records from AUSP table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT objek atinn atzhl mafid klart adzhl&lt;/P&gt;&lt;P&gt;    FROM ausp&lt;/P&gt;&lt;P&gt;   PACKAGE SIZE 10000&lt;/P&gt;&lt;P&gt;    APPENDING TABLE i_ausp&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN i_equi&lt;/P&gt;&lt;P&gt;  WHERE objek = i_equi-equnr&lt;/P&gt;&lt;P&gt;    and atinn in r_atinn_cf2&lt;/P&gt;&lt;P&gt;    and atzhl in r_atzhl&lt;/P&gt;&lt;P&gt;    and mafid in r_mafid&lt;/P&gt;&lt;P&gt;    and klart in r_klart&lt;/P&gt;&lt;P&gt;    and adzhl in r_adzhl.&lt;/P&gt;&lt;P&gt;    DESCRIBE TABLE i_ausp[] LINES vn_lines.&lt;/P&gt;&lt;P&gt;    IF vn_lines = cn_lines.&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;PERFORM export_data TABLES i_ausp.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      REFRESH i_ausp[].&lt;/P&gt;&lt;P&gt;      CLEAR vn_lines.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PERFORM export_data, I am exporting data as dataclusters into INDX table.&lt;/P&gt;&lt;P&gt;  EXPORT p_ausp TO DATABASE indx(au) ID index_ausp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will import this data in another program.&lt;/P&gt;&lt;P&gt;All this I am doing, as there is huge data and normal select is taking lots of time and the client wants it to happen faster. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As there are'nt any  people with this knowledge of OPEN CURSOR or Exporting / Importing data from data clusters, I request you to please let me know if my above approch is right. Now that you guys have said that OPEN CURSOR is not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Oct 2009 07:23:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199604#M1375895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-17T07:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199605#M1375896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I think the perform inside the SELECT will cause a COMMIT and this will cause a dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Oct 2009 19:46:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199605#M1375896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-17T19:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN CURSOR method to fetch data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199606#M1375897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; as there is huge data and normal select is taking lots of time and the client wants it to happen faster. &lt;/P&gt;&lt;P&gt;what is lots of time and what is faster?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up to 1.500.000 records is a lot, maybe the expectations are wrong. Otherwise, how often is it done? Once?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The export to database must also be committed of not? Then an open CURSOR WITH HOLD could help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the DESCRIBE is not necessary, it is even incorrect. At the end you get a rest which you don't know in advance.&lt;/P&gt;&lt;P&gt;So read with package size and process that package, refresh and SELECT the next package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Oct 2009 14:50:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-cursor-method-to-fetch-data/m-p/6199606#M1375897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-18T14:50:27Z</dc:date>
    </item>
  </channel>
</rss>

