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 single vs Select count

Former Member
0 Likes
3,630

Hi Team,

Please suggest me the best practice.

If I have to validate a field from DB.

Which stmt is preffered. Is it Select Single or Select Count.

Note : Target - Just to check if the record is exists in DB.

Please suggest the best way.

Thanks in Advance.

Ravindar.

8 REPLIES 8
Read only

Former Member
0 Likes
2,253

Use Select Single using all the table keys...

Read only

Former Member
0 Likes
2,253

hi,

Use select up to 1 rows,bcoz

select single shoul be used if u are comparing all key fields in the query else u have to use select up to 1 rows.

Read only

Former Member
0 Likes
2,253

select single from <table>

Read only

Former Member
0 Likes
2,253

Hi Ravindar,

Search the SCN before posting the basic question. You can find lot of treads for your query.

Reported!!!

Read only

Former Member
0 Likes
2,253

hi,

Using select up to 1 row is better way than the select single,

because select single hits the database more than once , where select up to 1 row hits only once in your program, hence a performance improver.

Thanks and regards

Sharath

Read only

Former Member
0 Likes
2,253

Hi,

It depends on your specified where clause.

If you are specifying full key part in where condition , then it is better to use SELECT SINGLE.

Regards

Pinaki

Read only

Former Member
0 Likes
2,253

Hi,

Select Single will take only one matching record from the database and stores inot buffer.

Select upto 1 rows will take all the records which are matching to that condition into the buffer.

so performance wise select upto 1 row is better than select single.

Regards,

jaya

Read only

Former Member
0 Likes
2,253

done