declare
tname varchar(10);
e exception;--定义异常
begin
select dname into tname from dept where deptno='70';
if tname='GUEST' THEN
raise e; --触发异常
end if;
dbms_output.put_line(tname);
exception
when e then
dbms_output.put_line('错误');
end;
tname varchar(10);
e exception;--定义异常
begin
select dname into tname from dept where deptno='70';
if tname='GUEST' THEN
raise e; --触发异常
end if;
dbms_output.put_line(tname);
exception
when e then
dbms_output.put_line('错误');
end;