Skip to content
Contents

How to check the number of records affected by DML within the stored procedure#

Use SQL%ROWCOUNT to find out how many records were affected by DML.

Example

CREATE OR REPLACE PROCEDURE proc1
AS
  v1 INTEGER;
BEGIN
  DELETE FROM MEM_T LIMIT 10 ;
  v1 := SQL%ROWCOUNT;
  PRINTLN(v1);
END;
/

Ex) 

iSQL> exec proc1;
10
Execute success.

IE users

Copying the procedure creation statement in IE may create a blank space, so please use the attached file if necessary. SP_DML_RECORD_COUNT.txt