<?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: Select Query with Like statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632032#M1282251</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;you can do it this way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RANGES : r_user_input for v_user_inp_pattern.

r_user_input-sign = 'I'.
r_user_input-sign = 'CP'.
concatenate '*' user_input '*' into r_user_input-low.
append r_user_input.

Select emp_name from &amp;lt;Database table&amp;gt; into table &amp;lt;internal table&amp;gt; where emp_name in r_user_input.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will improve your performance to a lot more extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2009 11:22:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-06T11:22:09Z</dc:date>
    <item>
      <title>Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632028#M1282247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi every one,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is, user will enter part of the employee name.I need to search the employees whose name contains the word entered by the user.For that I have used the following query.Functionality wise,It is working fine.But its taking more time.Please kindly advise me how can I improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate '%'  user_input  '%'   into v_user_inp_pattern .&lt;/P&gt;&lt;P&gt;Select emp_name from &amp;lt;Database table&amp;gt;  into  table &amp;lt;internal table&amp;gt; where emp_name like v_user_inp_pattern.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Selva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 09:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632028#M1282247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T09:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632029#M1282248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First get the data from database table into an internal table on the basis of primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use loop with where clause to read the required user name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method will fetch all the data from the database table still can be faster as in present approach no key is used .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you can contact basis to create a secondary index on the fields you are using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this may help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 09:56:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632029#M1282248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T09:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632030#M1282249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But the table which I used is the master one.It contains more than 2 Lakhs record.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 10:12:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632030#M1282249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T10:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632031#M1282250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to use primary key of the database table as follows :&lt;/P&gt;&lt;P&gt;*-- Declare fields as initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS:       c_vbeln    TYPE vbfa-vbeln      VALUE IS INITIAL,&lt;/P&gt;&lt;P&gt;     	           c_posnn 	  TYPE vbfa-posnn    VALUE IS INITIAL,&lt;/P&gt;&lt;P&gt;     	           c_vbtyp_n TYPE vbfa-vbtyp_n VALUE IS INITIAL.&lt;/P&gt;&lt;P&gt;*-- Use this in select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT vbelv posnv vbeln posnn vbtyp_n rfmng meins&lt;/P&gt;&lt;P&gt;  INTO TABLE gi_vbfa FROM vbfa&lt;/P&gt;&lt;P&gt;  WHERE vbelv   IN s_vbeln&lt;/P&gt;&lt;P&gt;  AND   posnv   IN s_posnv&lt;/P&gt;&lt;P&gt;  AND   vbeln   GE c_vbeln&lt;/P&gt;&lt;P&gt;  AND   posnn   GE c_posnn&lt;/P&gt;&lt;P&gt;  AND   vbtyp_n GE c_vbtyp_n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will fetch data using primary key and will improve results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 11:15:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632031#M1282250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T11:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632032#M1282251</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;you can do it this way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RANGES : r_user_input for v_user_inp_pattern.

r_user_input-sign = 'I'.
r_user_input-sign = 'CP'.
concatenate '*' user_input '*' into r_user_input-low.
append r_user_input.

Select emp_name from &amp;lt;Database table&amp;gt; into table &amp;lt;internal table&amp;gt; where emp_name in r_user_input.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will improve your performance to a lot more extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 11:22:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632032#M1282251</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T11:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632033#M1282252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Selva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if that is your only where condition...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Select emp_name from &amp;lt;Database table&amp;gt; into table &amp;lt;internal table&amp;gt; where emp_name like v_user_inp_pattern.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;depending on db... and indexes you have to do one of this 4 options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a big range scan (with client, if the table is client dependent) -&amp;gt; expensive&lt;/P&gt;&lt;P&gt;a full table scan &lt;/P&gt;&lt;P&gt;a full index scan&lt;/P&gt;&lt;P&gt;a fast full index scan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the last one would probably be the fastest... and only possible if you are&lt;/P&gt;&lt;P&gt;running on ORACLE and your index contains emp_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you could change your wild card to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate user_input '%' into v_user_inp_pattern .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it would be different... and faster solutions would become possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However all options have to touch ALL records... (in index blocks and or table blocks)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 11:32:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632033#M1282252</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-05-06T11:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632034#M1282253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; First get the data from database table into an internal table on the basis of primary key.&lt;/P&gt;&lt;P&gt;it is better to think twice before you write such nonsense!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only the last answer is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overall, what do you expect?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should try to offer a search, which uses a wildcard only at the end 'abcd%' is dramatically faster&lt;/P&gt;&lt;P&gt;than '%bcde%'. The second one is a full search of the whole content, there is not much you can do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 12:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632034#M1282253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T12:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632035#M1282254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's the table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 13:25:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632035#M1282254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T13:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632036#M1282255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 04:45:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632036#M1282255</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-22T04:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632037#M1282256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Rob,&lt;/P&gt;&lt;P&gt;this question is completely out-dated, why do you ask?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 14:33:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632037#M1282256</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-22T14:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query with Like statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632038#M1282257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried - did you see the date of my question &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OP had marked this as closed and included a meaningless message like 'resolved' or something. That brought it up to the top of the list. So I deleted that comment, leaving my old one as the last.&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, 22 Oct 2010 15:18:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-with-like-statement/m-p/5632038#M1282257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-22T15:18:25Z</dc:date>
    </item>
  </channel>
</rss>

