create or replace procedure xt_test(xtNo number) is
begin
update emp set sal=sal+100 where empno=xtNo;
end;
/上面定义一简单的存储过程,过程成功创建。
若执行 exec ex_test(9);提示“过程被成功完成”,
问题是 emp表中没有empno=9的人,怎么还提示过程成功完成?不解
begin
update emp set sal=sal+100 where empno=xtNo;
end;
/上面定义一简单的存储过程,过程成功创建。
若执行 exec ex_test(9);提示“过程被成功完成”,
问题是 emp表中没有empno=9的人,怎么还提示过程成功完成?不解
begin
update emp set sal=sal+100 where expno=xtNO;
if sql%rowcount=0 then
dbms_output.put_line('There is not this row');
end if;
end;
/写成这个样子
如果没有符合条件的记录的话就会给出提示。
--你写的过程与这句话没什么区别
SQL> update emp
2 set sal=sal+1000
3 where empno='9'
4 /
0 rows updated
--虽然没有更新,但是作为一个过程块,是成功执行的,
--成功执行的过程块,即使没有更新任何行,难道还会报错?