In Oracle 9i, in a command line program. How to dbms_output.put_line the number of affected lines (updated/deleted/inserted) between the previous BEGIN and the last COMMIT?
Plus, how to print the number of executed instructions (DML, DDL)?
In Oracle 9i, in a command line program. How to dbms_output.put_line the number of affected lines (updated/deleted/inserted) between the previous BEGIN and the last COMMIT?
Plus, how to print the number of executed instructions (DML, DDL)?
There's no easy way to get the number of statements executed, or a cumulative count of affected rows. You'll need to add code to track that yourself. For the number of statements you can just add one to a variable each time you execute. For the affected row count you can use the SQL%ROWCOUNT implicit cursor attribute:
You would need to reset the counter(s) after
commitorrollbackif you're only interested in committed values, and if you're going to be doing that mid-block; though that usually isn't necessary or a good idea.