Skip to content
Advertisement

Oracle save updated rows in log

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:

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;
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement