2020-04-03
如果输入的雇员不存在,则抛出自定义异常,这个语句哪里有错误吗,为什么不行
declare
nodatafound exception;
v_ename emp.ename%type:=’&ename’;
v_empno emp.empno%type;
v_sal emp.sal%type;
n number;
begin
select count(*),empno,sal into n,v_empno,v_sal from emp where ename=v_ename;
if n=0 then
raise nodatafound;
end if;
dbms_output.put_line(v_ename||‘的编号’||v_empno||‘薪水’||v_sal);
exception
when nodatafound then
raise_application_error(-20004,‘该雇员不存在’);
when others then
dbms_output.put_line(‘其他异常’);
end;
我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏

评论
