I have an update in my stored procedure. I would like to, save in my log the number of rows updated. How can I achieve this?
Advertisement
Answer
You can do something like this:
x
declare
l_rows_updated number;
begin
update table1 set col1 = 'abc' where foo = 'bar';
l_rows_updated := sql%rowcount;
insert into audit_table ( num_rows) values ( l_rows_updated );
end;