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!

using sql%found in explicit cursor

cs01kksMar 25 2015 — edited Mar 26 2015

Hi,

I was wondering the usage of sql%found in explicit cursor. Does the following not work?

Declare

cursor c1

is

select employee_name from employees where id = 10;

v_employee_name varchar2(100);

v_row_found          BOOLEAN DEFAULT FALSE;

begin

open c1;

fetch c1 into v_employee_name;

v_row_found := SQL%FOUND;

close c1;


if v_row_found then

dbms_output.put_line('row found');

else

dbms_output.put_line('row not found');

end if;

end;


Employee with id 10 exists in the system, but output is "row not found". I worked fine sometime back. Is behavior  of SQL%FOUND not always the same?

please advice.

thanks

kumar

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2015
Added on Mar 25 2015
6 comments
2,034 views