Get rowcount after rows are inserted in SQL stored procedure

86 views Asked by At

I need to get rowcount after an insert. In my stored procedure I am inserting values from one table into another based on an IN condition.

After that insert, I want to get the row count for each IN variable that it inserted.

If I use sql%rowcount, I get the combined count, so how many rows it inserted for addrtype = H and addrtype = O.

INSERT INTO TABLEB (ID, USERNAME, CITY)
    SELECT B.ID, USERNAME, ADDRESS
    FROM TABLEB B
    WHERE B.CITY = 'XYZ'
      AND B.ADDRTYPE IN ('H', '0')
DBMS_OUTPUT.put_line('Successfully LOADED data.');
0

There are 0 answers