Page 1 of 1

Count Effected Rows

Posted: Fri Oct 23, 2009 1:28 am
by Kashif
Dear Members

in PL/SQL if i update any record then how do i know that how much rows have been updated by the Query.
Example

Declare
Cursor c is
(Select Empno, name, comm from emp);
Begin
for REC in c loop
update emp set comm = comm+100
where comm is not null
and empno = rec.empno;
end loop;
end;


This is just an example coding

From this update query not all the records will effect.
this will update those records whcih have commision.
so how do i count that how much REcords have been update.


Thanks

Posted: Wed Oct 28, 2009 9:23 pm
by amirtai
Hi

Did you try the code below:

dbms_output.put_line('PLSQL Rows = '||TO_CHAR(SQL%ROWCOUNT));


Amir