Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525

    Unanswered: db2 'rows affected' internal variable

    Is there a simple way to trap the number of rows affected in a DB2 update within an SP? Hopefully something similar to Ingres' IIROWCOUNT variable.

    Thanks.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: db2 'rows affected' internal variable

    CREATE PROCEDURE proc1 (IN eno VARCHAR(3))
    LANGUAGE SQL
    BEGIN
    DECLARE SQLSTATE CHAR(5);
    DECLARE rows_updated INTEGER;
    UPDATE C1.EMPLOYEE
    SET = BONUS = SAL * 0.25
    WHERE EMPNO = eno ;
    GET DIAGNOSTICS rows_updated = ROW_COUNT;
    IF rows_updated = o THEN
    ...
    ...
    ...

    Is this what you are looking at ?

    Cheers

    Sathyaram


    Originally posted by Damian Ibbotson
    Is there a simple way to trap the number of rows affected in a DB2 update within an SP? Hopefully something similar to Ingres' IIROWCOUNT variable.

    Thanks.
    Last edited by sathyaram_s; 06-20-02 at 09:30.

  3. #3
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    That's exactly what I mean. Thanks a lot.

Posting Permissions

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