Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2007
    Posts
    24

    Unanswered: 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?

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  3. #3
    Join Date
    Mar 2006
    Location
    Tuticorin, India
    Posts
    103
    But I think db2_num_rows is available only on DB2 V9. Is there is any other equivalent on DB2 V8 ?

  4. #4
    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.

  5. #5
    Join Date
    Mar 2006
    Location
    Tuticorin, India
    Posts
    103
    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.

  6. #6
    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

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  8. #8
    Join Date
    Mar 2007
    Posts
    24
    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!

  9. #9
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •