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!

SELECT COUNT(*) INTO vs CURSOR c1 IS SELECT COUNT(*)

user12240205Feb 26 2014 — edited Mar 10 2014

Hi All,

Which of the 2 methods is better:

select count(*) into v_1 from table_name;

or

cursor c1 is select count(*)  from table_name;

open c1; fetch c1 into v_1; close c1;

My point is, the SELECT COUNT(*) INTO will never raise a NO_DATA_FOUND or TOO_MANY_ROWS.

So, isn't the SELECT COUNT(*) INTO better for count(*) queries?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2014
Added on Feb 26 2014
36 comments
7,929 views