Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have SQL Developer, + Oracle client 11g.

I wrote a program (MFC Visual C++) that read and writes data to a certain table. usually i put logs in the project so I could see what I insert/Update/Delete from the table.
Now I am about to delete multiple rows. and I would like to count the lines I deleted.

How can I know the latest queries that used in the DB, what they affected and get some data on activities that were held on the server ?

thanks !

share|improve this question
up vote 1 down vote accepted

To count the rows deleted just after the delete statement use SQL%ROWCOUNT. Here is a demonstration.

drop table t1;
create table t1 as (select level x from dual connect by level <=5);

set serveroutput on size 1000000 format wrapped
   vCount Number(3);
   DELETE FROM T1 WHERE rownum<=2;
   vCount := SQL%ROWCOUNT;  --<<---<<---<<---<<---<<---<<---<<---<<---
   DBMS_Output.Put_Line('RowCount:' || vCount);

For your broader question you can look into tracing, auditing, flashback database, flashback query, logminer, materialized views, streams, and change data capture (not necessarily in that order). We would need more details about what data you need and why before directing you any more specifically.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.