zoukankan      html  css  js  c++  java
  • oracle plsql 异常

     
    set serveroutput on
    
    DECLARE
    pename emp.ename%type;
    begin
    select ename into pename from emp where ename='1213';
    exception
    when
    no_data_found then     dbms_output.put_line('没有该数据');
    when
    others then  dbms_output.put_line('其他exception');
    end;
    set serveroutput on
    
    DECLARE
    pnum number;
    begin
    pnum:=1/0;
    exception
    when
    zero_divide then     dbms_output.put_line('0不能做除数');
    when
    others then  dbms_output.put_line('其他exception');
    end;
    set serveroutput on
    
    DECLARE
    pnum number;
    begin
    pnum:='abc';
    exception
    when
    value_error then     dbms_output.put_line('value_erroe');
    when
    others then  dbms_output.put_line('其他exception');
    end;
    set serveroutput on
    
    DECLARE
    pename emp.ename%type;
    begin
    select ename into pename from emp where deptno=10;
    exception
    when
    too_many_rows then     dbms_output.put_line('查询语句匹配了多行数据');
    when
    others then  dbms_output.put_line('其他exception');
    end;
  • 相关阅读:
    将本地文件夹添加到Git仓库
    flex调用Webservice(一)
    经典的sql
    打印相关
    reporting services订阅
    关于TabIndex
    试题(一)
    试试用手机
    2010.07.13_19:30
    基础知识
  • 原文地址:https://www.cnblogs.com/wangchuanfu/p/10987928.html
Copyright © 2011-2022 走看看