zoukankan      html  css  js  c++  java
  • Oracle异常处理内容,隐式游标

    异常处理

    create or replace procedure pr_test3(v_bh in varchar2,v_xx out t_hq_ryxx%rowtype) is
    begin
      
    select * into v_xx from t_hq_ryxx where bianh = v_bh;
    
    if sql%found then
      
    dbms_output.put_line('查找到数据了');
    else
      dbms_output.put_line('未查找到数据');
    
    end if;
    
    exception
    
      when NO_DATA_FOUND then
      --dbms_output.put_line('未查找到数据');
     
     dbms_output.put_line('SQLCODE = ' || SQLCODE);--错误代码
      dbms_output.put_line('SQLERRM = ' || SQLERRM);--错误信息
      
      
      when others then
      dbms_output.put_line('查找到出错');
      
    end pr_test3;
    /

    隐式游标

    create or replace procedure pr_test4(v_bh in varchar2) is
    
    v_xm t_hq_ryxx%rowtype;
    
    
    begin
      
    --v_xm := '106';
      
    pr_test3(v_bh, v_xm);
    
    dbms_output.put_line('v_xm = ' || v_xm.ruzrq || v_xm.xingm);
    
    
      
    end pr_test4;
    create or replace procedure pr_test5 is
    begin
      
    
    update t_hq_ryxx set bum = '101' where bum is null;
    
    
    if SQL%ROWCOUNT > 0 THEN
      dbms_output.put_line('更新了' || SQL%ROWCOUNT || '条记录');
      else
        
      dbms_output.put_line('更新了0条记录');
    end if;
      commit;
    end pr_test5;
    /
  • 相关阅读:
    ES6入门 阮一峰
    NPM
    移动端BUG
    配置每次git push 不需要输入账号密码
    移动端rem布局,用户调整手机字体大小或浏览器字体大小后导致页面布局出错问题
    课程表
    岛屿数量
    二叉树的右视图
    c++设计模式——工厂模式
    克隆图
  • 原文地址:https://www.cnblogs.com/shadowduke/p/4929091.html
Copyright © 2011-2022 走看看