View previous topic :: View next topic
|
Author |
Message |
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
I m deleting the rows from a table by firing DELETE QUERY,I will like to know how to get the count of the no. of rows deleted using SQL query. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Cketha wrote: |
I m deleting the rows from a table by firing DELETE QUERY,I will like to know how to get the count of the no. of rows deleted using SQL query. |
In the SQLCA it is field SQLERRD (3). See the DB2 SQL Reference Manual. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Cketha,
That value is returned when you do the delete, you don't need a separate query. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
SQLERRD(3) diagnostic array contains the no of records deleted/updated/inserted after the query has executed.
-Ajay |
|
Back to top |
|
|
vebs
New User
Joined: 27 Oct 2007 Posts: 19 Location: UK
|
|
|
|
In DB2 Version 8, you have a new statement which is GET DIAGNOSTICS. It can be used in application program to give the no. of rows that were updated, inserted, deleted or fetched. You can use it in your application code as follows
Code: |
EXEC SQL
GET DIAGNOSTICS :rcount = ROW_COUNT;
|
:rcount host variable will give you no. of rows deleted.
- Vaibhav |
|
Back to top |
|
|
|