oracle plsql 异常

Posted wangchuanfu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
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;

 

以上是关于oracle plsql 异常的主要内容,如果未能解决你的问题,请参考以下文章