2个回答
展开全部
declare
emp_no_temp exception ; 声明
e_sal number;
begin
select avg(sal) into e_sal from xxx where deptno=xxx ;
if e_sal>5000 then
raise emp_no_temp;
end if;
exception
when emp_no_temp exception then
dbms_output.put_line("该部门工资太高");
end;
__________________________________________
declare
e_sal number;
begin
select avg(sal) into e_sal from xxx where deptno=xxx ;
if e_sal>5000 then
raise_application_error(-20001,'该部门工资太高');
end if;
emp_no_temp exception ; 声明
e_sal number;
begin
select avg(sal) into e_sal from xxx where deptno=xxx ;
if e_sal>5000 then
raise emp_no_temp;
end if;
exception
when emp_no_temp exception then
dbms_output.put_line("该部门工资太高");
end;
__________________________________________
declare
e_sal number;
begin
select avg(sal) into e_sal from xxx where deptno=xxx ;
if e_sal>5000 then
raise_application_error(-20001,'该部门工资太高');
end if;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CREATE OR REPLACE PROCEDURE avg_sal
IS
ex_dept_sal EXCEPTION;
avg_sal NUMBER(10,2);
deptno varchar(10);
BEGIN
FOR t IN(select deptno,avg(sal) avg_sal from dept group by deptno) LOOP
IF t.avg_sal > 5000
THEN
avg_sal := t.deptno;
RAISE ex_dept_sal;
END IF;
END LOOP;
EXCEPTION WHEN ex_dept_sal
THEN
dbms_output.put_line(avg_sal||'部门工资太高');
WHEN
OTHERS THEN
NULL;
END;
IS
ex_dept_sal EXCEPTION;
avg_sal NUMBER(10,2);
deptno varchar(10);
BEGIN
FOR t IN(select deptno,avg(sal) avg_sal from dept group by deptno) LOOP
IF t.avg_sal > 5000
THEN
avg_sal := t.deptno;
RAISE ex_dept_sal;
END IF;
END LOOP;
EXCEPTION WHEN ex_dept_sal
THEN
dbms_output.put_line(avg_sal||'部门工资太高');
WHEN
OTHERS THEN
NULL;
END;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询