Search This Blog

Wednesday, September 21, 2022

Number of rows affected by an UPDATE in PL/SQL

 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; 


No comments:

Post a Comment

PL/SQL - Collections

A collection is an ordered group of elements having the same data type. Each element is identified by a unique subscript that represents its...