当前位置:Gxlcms > 数据库问题 > oracle plsql 异常

oracle plsql 异常

时间:2021-07-01 10:21:17 帮助过:3人阅读

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 异常

标签:nbsp   The   bsp   into   except   other   ide   error   int   

人气教程排行