<?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: DIff btn select single and select upto 1 row in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529595#M242215</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is there any thing related to performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Aug 2006 06:15:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-07T06:15:58Z</dc:date>
    <item>
      <title>DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529593#M242213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;what is the DIff btn select single and select upto 1 row?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SAI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:10:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529593#M242213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T06:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529594#M242214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt; Select single is used for selecting only one unique record. we pass all the key fields in the where clause to get the record on the generic combination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select up to one rows is used for selecting one row but here its not mandatory to give all the key fields in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;krishnakuamr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:14:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529594#M242214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T06:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529595#M242215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is there any thing related to performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:15:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529595#M242215</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T06:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529596#M242216</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 gets a single record either randomly or based from your where clause. On the other hand, select up to 1 rows will fetch you a single record either the oldest or latest record since you can add order by statement in your select when using select up to 1 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Please award points if found useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:18:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529596#M242216</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-08-07T06:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529597#M242217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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;Also have a look at:&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="154877"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:18:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529597#M242217</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T06:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529598#M242218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at:&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="2015865"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should solve your queries regarding performance, advantages, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 06:19:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529598#M242218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T06:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: DIff btn select single and select upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529599#M242219</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;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;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Irfan Hussain&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Award Points if it is helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 07:27:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-btn-select-single-and-select-upto-1-row/m-p/1529599#M242219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T07:27:48Z</dc:date>
    </item>
  </channel>
</rss>

