467,154 Members | 1,177 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,154 developers. It's quick & easy.

How to find no.of deleted rows

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
  • viewed: 8788
Share:
2 Replies
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
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.

Similar topics

reply views Thread by Ashish | last post: by
5 posts views Thread by Albert | last post: by
3 posts views Thread by Zorpiedoman | last post: by
reply views Thread by Tony Johansson | last post: by
4 posts views Thread by Joris De Groote | last post: by
4 posts views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
reply views Thread by ZSvedic | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.