View previous topic :: View next topic |
Author |
Message |
suma Beginner
Joined: 23 Jan 2006 Posts: 65 Topics: 29
|
Posted: Tue Jan 29, 2008 5:09 am Post subject: Delete- count of of records deleted |
|
|
Hi all,
Is it possible to count number of records deleted after successfull deletion records from a DB2 table using DELETE sql command.
thanks
Suma |
|
Back to top |
|
|
vkphani Intermediate
Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Tue Jan 29, 2008 5:27 am Post subject: |
|
|
Suma,
After the succesful execuetion of the sql Check for SQLERRD(3) from SQLCA. It will contain the no. of the rows deleted/updated like below. Here 5 rows are deleted.
Code: | SQLERRD = 0 0 5 -1 0 0 |
|
|
Back to top |
|
|
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Thu Jan 31, 2008 2:59 am Post subject: |
|
|
Hello Suma,
unfortunately, the number of rows implicitly deleted due to ON DELETE CASCADE defined relations for referential integrity are not reflected in the above mentioned counter.
Furthermore, if you execute a DELETE statement without a WHERE clause, then this counter is set to -1 , since otherwise the delete itself would consume too much ressources.
redards
Christian |
|
Back to top |
|
|
|
|