Home » SQL & PL/SQL » SQL & PL/SQL » Number of rows deleted?
Number of rows deleted? [message #43146] Fri, 13 June 2003 08:28 Go to next message
Matt Henderson
Messages: 1
Registered: June 2003
Junior Member
If I issue this query in sqlplus it tells me the number of rows that have been deleted:

SQL> delete from big_table
2 where col1 = 'P';

23 rows deleted.

....but if the query is part of a plsql block it doesn't output the number of rows deleted. Is there any inbuilt Oracle functionality for outputting this information? I could do a row count on the table before and after the delete and then output the number of rows deleted using dbms_output, but am hoping there is a better way.

Many thanks,
Matt
Re: Number of rows deleted? [message #43147 is a reply to message #43146] Fri, 13 June 2003 08:38 Go to previous message
Suraj K
Messages: 5
Registered: January 2003
Junior Member
begin

delete table xyz
where ... ;

dbms_output.put_line('rows deleted: '||sql%rowcount);
end;

Note: You can use this implicit cursor functionality for deriving the counts for inserts/updates as well.

Hope this helps.

Cheers.
Previous Topic: data modelling
Next Topic: dbms_output.new_line ... nothing happens!
Goto Forum:
  


Current Time: Tue Jul 29 08:45:00 CDT 2025