<?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: diffrence b/w select single &amp; select upto one row in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371959#M525565</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly:  to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &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;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jun 2007 08:52:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-01T08:52:19Z</dc:date>
    <item>
      <title>diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371955#M525561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;   wat is the diffrence b/w select single &amp;amp; select upto one row?&lt;/P&gt;&lt;P&gt;deepak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 08:25:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371955#M525561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T08:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371956#M525562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the links -&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="647631"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2773714"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpful replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 08:26:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371956#M525562</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2007-06-01T08:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371957#M525563</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;&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to read data from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 08:28:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371957#M525563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T08:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371958#M525564</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;Select single has to be used with a where condition that has all the key fields:&lt;/P&gt;&lt;P&gt;It will always return a unique record(If a match is found).&lt;/P&gt;&lt;P&gt;Select upto 1 rows would get your the first record if multiple matches are found.&lt;/P&gt;&lt;P&gt;and select up to has to be end with endselect statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;Mainly: to read data from &lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &lt;/P&gt;&lt;P&gt;Mainly: to check if entries exist. &lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;When you say SELECT SINGLE, it means that you are expecting only one row to be present in the database for the condition you're going to specify in the WHERE clause. so that means, you will have to specify the primary key in your WHERE clause. Otherwise you get a warning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT UP TO 1 ROWS is used in cases where you just want to make sure that there is at least one entry in the database table which satisfies your WHERE clause. Generally, it is meant to be used for existence-check. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may not want to really use the values returned by the SELECT statement in this case (thought this may not necessarily be so).And in each case the database optimizer may choose a different strategy to retrieve the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Knowing when to use SELECT SINGLE or SELECT ... UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database. Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're considering the statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE field INTO w_field FROM table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field INTO w_field FROM table UP TO 1 ROWS. ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memory usage and they may be worlds apart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this ?? The answer is simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm" target="test_blank"&gt;http://sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these links -&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3008075"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3108262"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2883069"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 08:33:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371958#M525564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T08:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371959#M525565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly:  to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &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;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 08:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371959#M525565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T08:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: diffrence b/w select single &amp; select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371960#M525566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepak,&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Younus&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward Helpful Answers:-)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 09:07:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diffrence-b-w-select-single-select-upto-one-row/m-p/2371960#M525566</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T09:07:48Z</dc:date>
    </item>
  </channel>
</rss>

