PL/SQL异常处理

declare
  v_price number(10,2);--单价
  v_usenum number;--水费字数
  v_usenum2 number;--使用吨数
begin
  v_price:=2.45;--每吨单价
 -- v_usenum := 10000000;
 select usenum into v_usenum from t_account t where t.id=2 and t.year='2012' and t.month='01';
  v_usenum2 := round(v_usenum/1000,2);
  DBMS_OUTPUT.put_line('字数为:'||v_usenum||'金额为:'||(v_price*v_usenum2));
  exception
   when no_data_found then
    DBMS_OUTPUT.put_line('没有找到账务数据');
end;

 

posted @ 2018-10-04 22:49  学亮编程手记  阅读(161)  评论(0编辑  收藏  举报