Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select -end-select or select single when we are not using primery key?

Former Member
0 Likes
807

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

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

4 REPLIES 4
Read only

Former Member
0 Likes
688

For twenty records, I wouldn't worry about it too much.

Rob

Read only

sachin_mathapati
Contributor
0 Likes
688

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

Read only

Former Member
0 Likes
689

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.

Read only

Former Member
0 Likes
688

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