If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Any way to see how many rows were updated?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-02-07, 18:42
Fumigator Fumigator is offline
Registered User
 
Join Date: Mar 2007
Posts: 24
Any way to see how many rows were updated?

MySQL (in PHP) has a function mysql_affected_rows() which returns the number of rows that an update or delete query affected. Is there a comparable function in DB2?
Reply With Quote
  #2 (permalink)  
Old 04-02-07, 19:56
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
db2_num_rows()

Sathyaram

Quote:
Originally Posted by Fumigator
MySQL (in PHP) has a function mysql_affected_rows() which returns the number of rows that an update or delete query affected. Is there a comparable function in DB2?
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 04-02-07, 21:19
db2udbgirl db2udbgirl is offline
Registered User
 
Join Date: Mar 2006
Location: Tuticorin, India
Posts: 100
But I think db2_num_rows is available only on DB2 V9. Is there is any other equivalent on DB2 V8 ?
Reply With Quote
  #4 (permalink)  
Old 04-03-07, 01:56
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Check the SQLCA.
Field SQLERRD(3) contains the number of affected rows after an INSERT, UPDATE or DELETE statement.
Reply With Quote
  #5 (permalink)  
Old 04-03-07, 09:10
db2udbgirl db2udbgirl is offline
Registered User
 
Join Date: Mar 2006
Location: Tuticorin, India
Posts: 100
I'm sorry I don't understand much from your comment. It would be of great help if you can provide me any handy URL if you have which explains about SQLCA.

Thanks.
Reply With Quote
  #6 (permalink)  
Old 04-03-07, 10:07
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
ckh for
get diagonistic statement

GET DIAGNOSTICS v_row_inserted = ROW_COUNT;
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #7 (permalink)  
Old 04-03-07, 10:35
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Another alternative is to simply select the results:
Code:
SELECT COUNT(*)
FROM NEW TABLE ( UPDATE ... ) AS t
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #8 (permalink)  
Old 04-03-07, 12:59
Fumigator Fumigator is offline
Registered User
 
Join Date: Mar 2007
Posts: 24
Quote:
Check the SQLCA.
Field SQLERRD(3) contains the number of affected rows after an INSERT, UPDATE or DELETE statement.
Reply With Quote
Ahh, that's the ticket. As soon as you said that, I remembered doing it back around 1994. Thanks!
Reply With Quote
  #9 (permalink)  
Old 04-04-07, 01:33
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Quote:
Originally Posted by db2udbgirl
I'm sorry I don't understand much from your comment. It would be of great help if you can provide me any handy URL if you have which explains about SQLCA.
Check the SQL-reference for more information.

http://publib.boulder.ibm.com/infoce...bknrsqlc999499
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On