Search This Blog

Number of rows affected by an UPDATE in PL/SQL

oracle PL/SQL

 

The following query can be used to know how many rows are updated. 


SQL%rowcount is used to find the number rows updated.


DECLARE 

    i NUMBER; 

BEGIN 

    UPDATE emp

    SET ename = 'SCOTT' 

    WHERE  empno =5577; 

    i := SQL%rowcount; 

    --note that assignment has to precede COMMIT

    COMMIT; 

    dbms_output.Put_line(i); 

END; 


For more tutorials visit our Oracle PL/SQL Blog.

No comments:

Post a Comment

comments are welcome