Count Effected Rows

In this forum you can share stuff related to Oracle 11g, 10g, 9i.
Post Reply
Kashif
Posts: 137
Joined: Wed Apr 26, 2006 5:57 am
Location: Pakistan
Contact:

Count Effected Rows

Post 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
amirtai
Posts: 138
Joined: Sat Apr 08, 2006 5:54 pm
Location: Canada
Contact:

Post by amirtai »

Hi

Did you try the code below:

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


Amir
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests