What is the diffrence between select single * and Select
upto 1 row?
Answers were Sorted based on User's Feedback
Answer / ad
The SELECT SINGLE statement selects the first record in the
database table depending on the condition mentioned in the
WHERE clause. Only the first record is returned and may not
be unique. ENDSELECT keyword is not needed here.
But for the case of SELECT UPTO 1 ROW, all relevant records
are being selected depending on the WHERE clause. Then any
aggregate or grouping or ordering condition is applied to
them and only the 1st record from the resultant set is
being returned. ENDSELECT is must here.
SELECT SINGLE should be used for selecting with full
primary key combination but SELECT UP TO 1 ROWS is the
special case of SELECT UP TO n ROWS and can be used with
any WHERE condition.
As regarding the speed or performance it depends on various
conditions. If your database table contains several
entries, then SELECT UPTO 1 ROWS might take a longer time
to fetch and order all relevant records. But for limited
entries check for full primary key combination takes more
time in case of SELECT SINGLE. If you donot provide all
primary keys in SELECT SINGLE you will get message during
extended syntax check (SLIN).
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / kiran kumar v
Select Single * -- 1) Will never have endselect.2)
Applicable key fields are mentioned in Where clause.3) It
retrieves the first record which matches the condition.
Select upto 1 row -- 1) Will have endselect. 2)Where clause
is not mandatory. 3) Pull up all the records and display
the first record in the list.
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / m raj
If i know the answer, i would have got the better job.
Is This Answer Correct ? | 17 Yes | 13 No |
Answer / chitta ranjan mahato
I am agree with the above answers given but I am to add
few lines.
Select Single can give you best performace when it is fired
with full primary key.
Select up to 1 rows is a special case of select up to n
rows.
there is almost no difference in performace in small
database. select single is used to check the avaviility of
particular record in database.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / chittidi
select single f1 f2 f3 ... into <wa> from <dbtab> where
<condition>. this where condition is important to fetch
exact record from database . for thsi purpose we provide
entire primary key combination in whrere conditon.
by using this statement to read exact information .
select f1 f2 f3 .... into <wa> from <dbtab> up to 1 rows
where <condition>
endselect.
it reads the first record found which may not be exact .
the where condition can be part of primary key combination.
it is mainly used to validate the INPUT.
IF WE ARE NOT PASSING ENTIRE COMBINATION OF PRIMARY KEY
IN SELET * SINGLE IT SIMPLY ACTS AS SELECT * UP TO 1 ROWS.
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / kapil goyal
Select single fetches first matching record. If more than one matching records are there then only the first matching record will be considered other records will not be taken into account. Where as select up to 1 rows will fetch all the matching records from the database.(Again it will assign only One Record to the internal table/Work area)
Is This Answer Correct ? | 1 Yes | 0 No |
what are performence analysis techniques?
What is meant by hotspots?
3) What happens if there is no CLOSE_GROUP in a BDC.
Can you create a table with fields not referring to data elements? : abap data dictionary
does select single *.. / select * .. affect performance ? how?
How is conversion of data types done between abap/4 & db layer? : abap data dictionary
Define external layer? : abap data dictionary
what is the functionality of Runtime Analysis?
Suppose i have table with 2 columns say 1st with Numerics and 2nd with words like 1 for one and 2 for two......so.if i want to change the 9 numeric word as some twenty...how?
what is mean by table control, where it is used? why it is use?
How is conversion of data types done between abap/4 & external level?
what are customizing?have u created any customizing table? for what purpose?