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 |
How do you retrieve the data for repetitive structures
can u create internal table dynamically ? how?
4 Answers Bristle Cone, Cap Gemini, HP, IBM, MetaMorph, Satyam, Wipro,
How to validate the entry in Screen & dialog proframming?? Is there any way to send the error??
How can you remove leading zeros of a number in script?
Describe data classes? : abap hr
There is a delivery that is being created through the ABAP code and in the middle it says delivery created but someone is modifying , how would you rectify this issue
14) Purpose of the statemement TABLE in a report?
Without writing the event start-of-selection we can execute a report program.Then what's the purpose of writing it?
how can i change rows inot columns in the finaldisplay list
1 Answers Bristle Cone, IBM, TCS,
I want to give a input/output field on list , where can I define it?
which one is efficient in following command to copy data from one itab1to another itab2 . both itab table has same structure. 1. move itab1 to itab2 2.move corresponding field of itab1 to itab2 3. itab2[] = itab2[] 4.appends line of itab1 to itab2..
Hi, I have a requirement for locking the fax field in user master records. As you know user can edit the details using the System>profile>own data (SU3), it is causing some security threat to our model. What i want is users should not be able to change the fax field under communications when they get into su3.I have heard of user Exist functionality but don't know how to implement it. Can you suggest something, it will be greatly appreciated.