raka
raka

Reputation: 133

PL/SQL : How to capture the return value of a statement?

In the PL/SQL Script I want to capture the number of rows affected with a particular statement, something like

BEGIN
   del_count := { DELETE FROM <SOME_TABLE>}
END

How to achieve this ?

Upvotes: 1

Views: 53

Answers (1)

Sathyajith Bhat
Sathyajith Bhat

Reputation: 21851

Use SQL%ROWCOUNT;

BEGIN

   DELETE FROM EMPLOYEES  
   WHERE MANAGER = 10;
   dbms_output.put_line(SQL%ROWCOUNT || ' rows were deleted');

END;

Upvotes: 2

Related Questions