您的位置:首页 > 博客中心 > 数据库 >

PL/SQL异常处理

时间:2022-03-15 11:07

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;

技术分享图片

 

热门排行

今日推荐

热门手游