‎2008 Jun 12 10:09 AM
hi all,
can anyone please tell me What is the difference between 'SELECT SINGLE' and 'SELECT UPTO ONE ROWS'?
regards saurabh.
‎2008 Jun 12 10:11 AM
Hi,
SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.
SELECT ... UP TO 1 ROWS retrieves all the matching records and applies aggregation and ordering and returns the first record.
Inorder to check for the existence of a record then it is better to use SELECT SINGLE than using SELECT ... UP TO 1 ROWS since it uses low memory and has better performance."
Hope this helps u.
Thanks and Regards,
Ruthra
‎2008 Jun 12 10:11 AM
The result is the same, but SELECT SINGLE should only be used if you can specify the primary key(s) fully.
Regards,
John.
‎2008 Jun 12 10:11 AM
Hi,
SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.
SELECT ... UP TO 1 ROWS retrieves all the matching records and applies aggregation and ordering and returns the first record.
Inorder to check for the existence of a record then it is better to use SELECT SINGLE than using SELECT ... UP TO 1 ROWS since it uses low memory and has better performance."
Hope this helps u.
Thanks and Regards,
Ruthra
‎2008 Jun 12 10:12 AM
‎2008 Jun 12 10:12 AM
Hi,
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.
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.
<REMOVED BY MODERATOR>
Naresh.
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:10 PM
‎2008 Jun 12 10:12 AM
hi
go thru the links
http://www.sapdb.org/htmhelp/40/1312152fa511d3a98100a0c9449261/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm
http://www.sapdb.org/7.4/htmhelp/40/1311fd2fa511d3a98100a0c9449261/content.htm
http://dev.mysql.com/doc/maxdb/en/40/1312152fa511d3a98100a0c9449261/content.htm
regards,
‎2008 Jun 12 10:13 AM
both statements return one row, but to improve performance of code
use 'select single'
‎2008 Jun 12 10:17 AM
Hi,
Please learn to SEARCH - this is a basic question that has been asked and answered time and time again. Also try to use the F1 key on your keyboard or look at help.sap.com where all ABAP commands are explained. Also read the WIKI here on SDN.
Gareth.