How to Determine the Number of Affected Rows
The third element of the SQLCA array sqlerrd indicates how many rows were affected by the last row-affecting statement. The following program fragment, which deletes all employees whose employee numbers are greater than a given number, demonstrates how to use sqlerrd:
procedure Delete_Rows( lower_bound: in Integer ) is
exec sql begin declare section;
lower_bound_num: integer := lower_bound;
exec sql end declare section;
begin
exec sql delete from employee
where eno > :lower_bound_num;
-- Print the number of employees deleted.
put( sqlca.sqlerrd(3) );
put_line( " (rows) were deleted.");
end Delete_Rows;