2008 Jan 24 3:10 PM
hi experts,
i need to get single record from database.but iam not passing primary key.so in this case which one is Recomended select -endselect or select single ?.database is holding around around 20 records.
If we are selecting any one how it will efficent with other?
Thankx
Regards
Anwar Ali
2008 Jan 25 5:03 AM
Hi Anwar,
If you are interested in exactly one row of the db table or view, use the SELECT SINGLE
statement instead of the SELECT-ENDSELECT-loop, as SELECT SINGLE requires one
communication with the database system whereas SELECT-ENDSELECT needs two.
Hope this is helpful to you!!
Thanks and Regards,
Sriranjani Chimakurthy.
hi experts,
i need to get single record from database.but iam not passing primary key.so in this case which one is Recomended select -endselect or select single ?.database is holding around around 20 records.
If we are selecting any one how it will efficent with other?
Thankx
Regards
Anwar Ali
2008 Jan 24 5:02 PM
For twenty records, I wouldn't worry about it too much.
Rob
2008 Jan 25 4:12 AM
Hi Anwar,
Select single will give the first matching record and select endselect may give the last matching record.
So based on your requirement you decide which one you require.
Regards,
Sachin M M
2008 Jan 25 5:03 AM
Hi Anwar,
If you are interested in exactly one row of the db table or view, use the SELECT SINGLE
statement instead of the SELECT-ENDSELECT-loop, as SELECT SINGLE requires one
communication with the database system whereas SELECT-ENDSELECT needs two.
Hope this is helpful to you!!
Thanks and Regards,
Sriranjani Chimakurthy.
2008 Jan 25 9:10 AM
20 records in total will never be a performance problem!
User SELECT SINGLE if you specify the fully primary key with equal, i.e. there is only one row which can fulfill the where condition.
Use UP TO n ROWS if you want one row but there are several rows which can fulfill the WHERE condition. It is not clear which row you get.
Use SELECT ... INTO TABLE if there are several rows fulfilling the WHERE condition and sort the table later to get the largest or smallest row.
Siegfried
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |