Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fastest way to check if a record exists

mail8mzNov 20 2012 — edited Nov 21 2012
Hi,

I have a table with more than 100M records. What is the fastest way to check if a record exists or not. Currently, I am using Oracle 11.2. The following is the SQL I used, id is the primary key of the table_test.

select count(*) into existFlag
from table_test
where id = testID
;
This post has been answered by Solomon Yakobson on Nov 20 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2012
Added on Nov 20 2012
23 comments
12,865 views