下の例は、update文になっているけどdeleteやmergeなどでも同じように取得できます。
begin
update account set name = '名前変更' where id = '00001';
-- sql%foundを使用して更新有無を判断
-- trueの場合は更新あり
if (sql%found) then
dbms_output.put_line('updated');
else
dbms_output.put_line('no updated');
end if;
-- sql%rowcountで更新件数を取得
dbms_output.put_line(sql%rowcount);
end;
実行結果
updated 1 PL/SQL procedure successfully completed.