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!

Get count of updated rows

Top_Turn_BuckleDec 14 2017 — edited Jul 23 2019

Hello Experts,

I would like to know the number of rows modified by an UPDATE DML in a table.

My source is an oracle collection.

Code:

set serveroutput on
declare

type t1 is table of emp%ROWTYPE;
tab1 t1;

cursor c1
is
  select * from emp;

begin

open c1;
fetch c1 bulk collect into tab1;
forall i in tab1.FIRST..tab1.LAST
    update emp
    set sal = 100
    where sal != tab1(i).sal;
close c1;
  
rollback;

end;
/

Could you please help me.

Thanks,

Haider

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2018
Added on Dec 14 2017
40 comments
5,457 views