By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,610 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,610 IT Pros & Developers. It's quick & easy.

How to find no.of deleted rows

P: n/a
Whenever delete is performed on a DB2 database, it just returns
"...command completed successfully.."
db2 =select count(*) from sales
1
-----------
12
1 record(s) selected.

db2 =delete from sales
DB20000I The SQL command completed successfully.

Is there a method available to find the no of records it indeed
delete ?

Aug 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sam Durai wrote:
Whenever delete is performed on a DB2 database, it just returns
"...command completed successfully.."
db2 =select count(*) from sales
1
-----------
12
1 record(s) selected.

db2 =delete from sales
DB20000I The SQL command completed successfully.

Is there a method available to find the no of records it indeed
delete ?
Teh SQLCA.ERRD(3) field contains tehnumber of rows deleted.
In an SQL Procedure you get it with:
GET DIAGNOSTICS <var= ROW_COUNT

Or:
SELECT COUNT(*) FROM OLD TABLE(DELETE FROM sales);

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Aug 2 '07 #2

P: n/a
Lew
when using the clp you can use the -a option which shows the sqlca:
db2 -a "delete from sales"

On Aug 2, 2:29 pm, Sam Durai <reachsamdu...@gmail.comwrote:
Whenever delete is performed on a DB2 database, it just returns
"...command completed successfully.."
db2 =select count(*) from sales
1
-----------
12
1 record(s) selected.

db2 =delete from sales
DB20000I The SQL command completed successfully.

Is there a method available to find the no of records it indeed
delete ?

Aug 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.