oracle 自定义例外

--自定义例外

create or replace sp_test(password in varchar2,id in number)
is
--定义部分
myexception exception;
begin
--执行部分
	update user set  password=password  where id=id;
	--sql%notfound便是没有更新数据是返回true
	 if sql%notfound then;	   --当没有更新数据时
	   raise myexception;--触发myexception异常
	 end if;
	exception 
	  when  myexception then
	   dbms_output.put_line('没有更新数据');
end;
 

猜你喜欢

转载自javaeedevelop.iteye.com/blog/1551322