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: Integer );
exec sql begin declare section;
var
lower_bound_num: Integer;
exec sql end declare section;
begin
lower_bound_num := lower_bound;
exec sql delete from employee
where eno > :lower_bound_num;
{Print the number of employees deleted.}
writeln( sqlca.sqlerrd[3], ' (rows) were deleted.' );
end; {Delete_Rows}