<?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: Oracle hint needed for a select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496434#M840970</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select .... from table1 into table itab
         where field1 = value1
          and  field2 = value2
        %_hints oracle 'INDEX (TABLE1 INDEX_NAME)'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the index name from SE11 --&amp;gt; Indexes --&amp;gt; double click on index number --&amp;gt; Index name as stored in database system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Mar 2008 19:41:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-13T19:41:53Z</dc:date>
    <item>
      <title>Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496429#M840965</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;The index of table was changed so I had readjust my SELECT statement . Now I needed to write a ORACLE hint for this new index . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do write a hint ? Please advise . I have never written an hint before . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My select statement is as below and table is MDRS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT * FROM MDRS&lt;/P&gt;&lt;P&gt;           INTO TABLE ITAB_MDRS&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN ZMATERIAL&lt;/P&gt;&lt;P&gt;           WHERE MATNR = ZMATERIAL-MATNR&lt;/P&gt;&lt;P&gt;           AND   XLOEK = X_XLOEK&lt;/P&gt;&lt;P&gt;           AND   KZEAR = X_KZEAR&lt;/P&gt;&lt;P&gt;           AND   WERKS IN WERKS_RANGE&lt;/P&gt;&lt;P&gt;           AND   BDART IN BDART_RANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Teresa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:06:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496429#M840965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496430#M840966</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;check this for all entries ex , then u may understand the logic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ztest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:pa0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0008-pernr,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;      end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :begin of itab2 occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0021-pernr,&lt;/P&gt;&lt;P&gt;      favor like pa0021-favor,&lt;/P&gt;&lt;P&gt;      fanam like pa0021-fanam,&lt;/P&gt;&lt;P&gt;      end of itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of itab3 occurs 0,&lt;/P&gt;&lt;P&gt;     pernr like pa0041-pernr,&lt;/P&gt;&lt;P&gt;     dar01 like pa0041-dar01,&lt;/P&gt;&lt;P&gt;     dat01 like pa0041-dat01,&lt;/P&gt;&lt;P&gt;     end of itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of final occurs 0,&lt;/P&gt;&lt;P&gt;      pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;      vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;      nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;      begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;      stvor like pa0008-stvor,&lt;/P&gt;&lt;P&gt;      ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;       favor like pa0021-favor,&lt;/P&gt;&lt;P&gt;      fanam like pa0021-fanam,&lt;/P&gt;&lt;P&gt;     dar01 like pa0041-dar01,&lt;/P&gt;&lt;P&gt;     dat01 like pa0041-dat01,&lt;/P&gt;&lt;P&gt;     end of final.&lt;/P&gt;&lt;P&gt;select-options:s_pernr for pa0002-pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       vorna&lt;/P&gt;&lt;P&gt;       nachn&lt;/P&gt;&lt;P&gt;       from pa0002&lt;/P&gt;&lt;P&gt;       into table itab&lt;/P&gt;&lt;P&gt;       where pernr in s_pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       stvor&lt;/P&gt;&lt;P&gt;       ansal&lt;/P&gt;&lt;P&gt;       from pa0008&lt;/P&gt;&lt;P&gt;       into table itab1&lt;/P&gt;&lt;P&gt;       for all entries in itab&lt;/P&gt;&lt;P&gt;       where pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       favor&lt;/P&gt;&lt;P&gt;       fanam&lt;/P&gt;&lt;P&gt;       from pa0021&lt;/P&gt;&lt;P&gt;       into table itab2&lt;/P&gt;&lt;P&gt;       for all entries in itab1&lt;/P&gt;&lt;P&gt;       where pernr = itab1-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       dar01&lt;/P&gt;&lt;P&gt;       dat01&lt;/P&gt;&lt;P&gt;       from pa0041&lt;/P&gt;&lt;P&gt;       into table itab3&lt;/P&gt;&lt;P&gt;       for all entries in itab2&lt;/P&gt;&lt;P&gt;       where pernr = itab2-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;final-pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-vorna = itab-vorna.&lt;/P&gt;&lt;P&gt;final-nachn = itab-nachn.&lt;/P&gt;&lt;P&gt;read table itab1 with key pernr = itab-pernr.&lt;/P&gt;&lt;P&gt;final-begda = itab1-begda.&lt;/P&gt;&lt;P&gt;final-stvor = itab1-stvor.&lt;/P&gt;&lt;P&gt;final-ansal = itab1-ansal.&lt;/P&gt;&lt;P&gt;read table itab2 with key pernr = itab1-pernr.&lt;/P&gt;&lt;P&gt;final-favor = itab2-favor.&lt;/P&gt;&lt;P&gt;final-fanam = itab2-fanam.&lt;/P&gt;&lt;P&gt;read table itab3 with key pernr = itab2-pernr.&lt;/P&gt;&lt;P&gt;final-dar01 = itab3-dar01 .&lt;/P&gt;&lt;P&gt;final-dat01 = itab3-dat01.&lt;/P&gt;&lt;P&gt;append final.&lt;/P&gt;&lt;P&gt;clear final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   loop at final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   write:final-pernr ,&lt;/P&gt;&lt;P&gt;final-vorna ,&lt;/P&gt;&lt;P&gt;final-nachn ,&lt;/P&gt;&lt;P&gt;final-begda ,&lt;/P&gt;&lt;P&gt;final-stvor ,&lt;/P&gt;&lt;P&gt;final-ansal ,&lt;/P&gt;&lt;P&gt;final-favor ,&lt;/P&gt;&lt;P&gt;final-fanam ,&lt;/P&gt;&lt;P&gt;final-dar01 ,&lt;/P&gt;&lt;P&gt;final-dat01 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:16:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496430#M840966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496431#M840967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the index look like now?  Are you sure that it isn't already using it?  If your WHERE clause matches (more or less), the index, the optimizer may decide on its own to use it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:21:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496431#M840967</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496432#M840968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The order of the  index is &lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;MANDT&lt;/P&gt;&lt;P&gt;MATNR&lt;/P&gt;&lt;P&gt;XLOEK&lt;/P&gt;&lt;P&gt;KZEAR&lt;/P&gt;&lt;P&gt;WERKS&lt;/P&gt;&lt;P&gt;BDART&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:32:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496432#M840968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496433#M840969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your where clause matches the index perfectly.  I do not think you need a hint.  I would verify this by running a SQL trace (txn ST05).  That will tell you the Explain Plan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may want to also tell your basis guys to make sure that there are "statistics" on the table and index, just to be safe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:35:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496433#M840969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496434#M840970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select .... from table1 into table itab
         where field1 = value1
          and  field2 = value2
        %_hints oracle 'INDEX (TABLE1 INDEX_NAME)'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the index name from SE11 --&amp;gt; Indexes --&amp;gt; double click on index number --&amp;gt; Index name as stored in database system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:41:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496434#M840970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496435#M840971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean "the index was changed?"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does RESB-M look like now?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Mar 2008 19:53:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496435#M840971</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-13T19:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496436#M840972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it needed to put %_hints when we want to use a index in a select statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 13:16:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496436#M840972</guid>
      <dc:creator>marcelom_bovo</dc:creator>
      <dc:date>2011-08-30T13:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496437#M840973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oracle hints sample code is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM ABCD&lt;/P&gt;&lt;P&gt;    INTO TABLE t_ABCD&lt;/P&gt;&lt;P&gt;    WHERE f1 = xyz&lt;/P&gt;&lt;P&gt;    %_HINTS ORACLE 'INDEX("ABCD" "ABCD~Z01")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Jerry suggested index will found automatically. Just change you where clause as below. Just do a performance analysis from st05 or SM50, if any index is found or not. If you changed the table index or did any changes in the table just adjust the table indexes from se14.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM MDRS&lt;/P&gt;&lt;P&gt;INTO TABLE ITAB_MDRS&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN ZMATERIAL&lt;/P&gt;&lt;P&gt;WHERE MATNR = ZMATERIAL-MATNR&lt;/P&gt;&lt;P&gt;AND WERKS IN WERKS_RANGE&lt;/P&gt;&lt;P&gt;AND XLOEK = X_XLOEK&lt;/P&gt;&lt;P&gt;AND KZEAR = X_KZEAR&lt;/P&gt;&lt;P&gt;AND BDART IN BDART_RANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Subhankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 17:44:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496437#M840973</guid>
      <dc:creator>Subhankar</dc:creator>
      <dc:date>2011-08-30T17:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496438#M840974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appears that MDRS is a view for table RESB, which has an 'M' index that should do most of what you need....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd try....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if lines( zmaterial ) gt 0.
SELECT * FROM RESB INTO TABLE ITAB_resb
FOR ALL ENTRIES IN ZMATERIAL
WHERE MATNR   =  ZMATERIAL-MATNR
     AND WERKS  IN  WERKS_RANGE
     AND XLOEK   =   X_XLOEK
     AND KZEAR   =   X_KZEAR
     AND BDART IN BDART_RANGE.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Check your tract for that statement and see if you do an index range scan for the "m" index on RESB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: DaveL on Aug 31, 2011 2:05 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 12:04:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496438#M840974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-31T12:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle hint needed for a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496439#M840975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot problm solv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2015 06:04:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oracle-hint-needed-for-a-select-statement/m-p/3496439#M840975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-11-02T06:04:16Z</dc:date>
    </item>
  </channel>
</rss>

