oracle plsql 异常

前端之家收集整理的这篇文章主要介绍了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相关文章